forked from rhyndo/fe1-presentations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2013-08-22-01.html
634 lines (522 loc) · 14.1 KB
/
2013-08-22-01.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
---
layout: lecture
title: "01 HTML Basics"
date: 2013-08-22 18:48:45
categories: lecture
---
<section>
<h2>HTML Basics</h2>
</section>
<section>
<section data-markdown>
<script type="text/template">
## HTML — HyperText Markup Language
HTML is the main markup language for creating web pages and other information that can be displayed in a web browser.
* HTML is a markup language
* HTML is a language for describing web pages.
* HTML documents contain HTML tags and plain text
* A markup language is a set of markup tags
* The tags describe document content
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
## Web browser
The purpose of a web browser is to read HTML documents and compose them into visible or audible web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## HTML Tags
Tags are keywords surrounded by angle brackets
```
'<' + 'html' + '>' - <html>
'<' + 'head' + '>' - <head>
'<' + 'body' + '>' - <body>
'<' + 'p' + '>' - <p>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
### HTML Tag pairs
HTML tags normally come in pairs
```
'<' + 'p' + '>' and '</' + 'p' + '>'
```
The first tag in a pair is the start tag, the second tag is the end tag
The end tag is written like the start tag, with a forward slash before the tag name
Start and end tags are also called opening tags and closing tags
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
### HTML Tag pair examples
```
Opening tag Closing tag
'<' + 'html' + '>' - '</' + 'html' + '>'
'<' + 'head' + '>' - '</' + 'head' + '>'
'<' + 'body' + '>' - '</' + 'body' + '>'
'<' + 'p' + '>' - '</' + 'p' + '>'
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section>
<section class="codebigger" data-markdown>
<script type="text/template">
### Main HTML tags
__`<html></html>`__
describes the start and end of the web page/document
__`<head></head>`__
is the start and end of the metadata section of the document
__`<body></body>`__
is the start and end of the visible page content
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
## HTML Page/Document structure
Code
```
<html>
<head>
<title>Simple HTML document example</title>
</head>
<body>
<h1>Simple HTML document example</h1>
</body>
</html>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
### HTML Versions
Time passes, people think of new ways to entertain themselves. So new versions of HTML have been created.
How do we differentiate between the different versions?
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
### The <!DOCTYPE> Declaration
There are many different documents on the web, and a browser can only display an HTML page 100% correctly if it knows the HTML type and version used.
</script>
<aside class="notes" data-markdown>
DOCTYPE Reference.
http://www.w3schools.com/tags/tag_doctype.asp
</aside>
</section>
<section class="codesmaller" data-markdown>
<script type="text/template">
### Common Declarations - Page 1
HTML 4.01 Strict
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
```
HTML 4.01 Transitional
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
```
HTML 4.01 Frameset
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmaller" data-markdown>
<script type="text/template">
### Common Declarations - Page 2
XHTML 1.0 Strict
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
```
XHTML 1.0 Transitional
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
```
XHTML 1.1
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmaller" data-markdown>
<script type="text/template">
### Common Declarations - Page 3
HTML5
```
<!DOCTYPE html>
```
Finally!!!
Something we can all remember.
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
### Now, lets update our HTML document
```
<!DOCTYPE html>
<html>
<head>
<title>Simple HTML document example</title>
</head>
<body>
<h1>Simple HTML document example</h1>
</body>
</html>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section>
<section class="codesmall" data-markdown>
<script type="text/template">
## Quick overview of the most used tags
#### Headings
```
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
```
#### Paragraphs
```
<p>Something smart</p>
```
</script>
<aside class="notes" data-markdown>
Tag reference
http://www.w3schools.com/tags/default.asp
</aside>
</section>
<section class="codesmall" data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Text formatting
```
<strong></strong>
<em></em>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Links
```
<a href="http://initlab.org">init Lab</a>
```
#### Images
```
<img src="/images/icons/terminal.png">
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmall" data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Quotes
```
<cite></cite>
```
#### Multiple paragraph quotes
```
<blockquote>
<p>Smart quote</p>
</blockquote>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmall" data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Lists
Ordered list
```
<ol>
<li>List item</li>
<li>List item</li>
</ol>
```
Unordered list
```
<ul>
<li>List item</li>
<li>List item</li>
</ul>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmall" data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Definition list
```
<dl>
<dt>Definition title</dt>
<dd>Definition description</dd>
<dt>Definition title</dt>
<dd>Definition description</dd>
</dl>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmall" data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Tables
```
<table>
<thead>
<tr>
<th>Table header 1</th>
<th>Table header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Table cell 1</td>
<td>Table cell 1</td>
</tr>
</tbody>
</table>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section class="codesmall" data-markdown>
<script type="text/template">
### Quick overview of the most used tags
#### Forms
```
<form action="#" method="get">
<fieldset>
<legend>Login information</legend>
<label for="username">Username</label>
<p><input type="text" name="username" value="" id="username" /></p>
<label for="password">Password</label>
<p><input type="text" name="password" value="" id="password" /></p>
</fieldset>
<fieldset>
<legend>Personal information</legend>
<label for="name">Full Name</label>
<p><input type="text" name="name" value="" id="name" /></p>
<label for="adress">Address</label>
<p><textarea name="adress" id="adress" rows="4" cols="40"></textarea></p>
<input type="checkbox" name="mail" value="" id="mail" />
<label for="mail">I want to recieve mail</label>
</fieldset>
<p><input type="submit" value="Continue →"></p>
</form>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section>
<section data-markdown>
<script type="text/template">
## Tag attributes
Attributes provide additional information about HTML elements.
* Tags elements can have attributes
* Attributes provide additional information about an element
* Attributes are always specified in the start tag
* Attributes come in name/value pairs like: name="value"
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
### Some examples of Tag attributes
#### Links
```
<a href="http://initlab.org">init Lab</a>
```
#### Images
```
<img src="/images/icons/terminal.png">
```
#### Tables
```
<table width="100%" cellspacing="0" cellpadding="0">
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section>
<h2>Global Attributes Reference</h2>
<a href="http://www.w3schools.com/tags/ref_standardattributes.asp">http://www.w3schools.com/tags/ref_standardattributes.asp</a>
</section>
<section data-markdown>
<script type="text/template">
## Few tips
#### Always Quote Attribute Values
Attribute values should always be enclosed in quotes.
Double style quotes are the most common, but single style quotes are also allowed.
#### Be careful when combining single and double quotes
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section class="codesmaller">
<section data-markdown>
<script type="text/template">
## Metadata section
#### `<head>` tag
The `<head>` element is a container for all the head elements. Elements inside `<head>` can include scripts, instruct the browser where to find style sheets, provide meta information, and more.
The following tags can be added to the head section:
`<title>`, `<style>`, `<meta>`, `<link>`, `<script>`, `<noscript>`
</script>
<aside class="notes" data-markdown>
http://www.w3schools.com/html/html_head.asp
</aside>
</section>
<section data-markdown>
<script type="text/template">
### Metadata - inside the `<head>` tag
#### `<title>`
The `<title>` tag defines the title of the document.
```
<head>
<title>HTML Document title</title>
</head>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
#### `<meta>`
Metadata is data (information) about data.
The `<meta>` tag provides metadata about the HTML document.
__Examples__
```
<!-- Define keywords for search engines: -->
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">
<!--Define a description of your web page:-->
<meta name="description" content="Free Web tutorials on HTML and CSS">
<!--Define the author of a page:-->
<meta name="author" content="Hege Refsnes">
<!--Refresh document every 30 seconds:-->
<meta http-equiv="refresh" content="30">
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
#### `<link>`
The `<link>` tag defines the relationship between a document and an external resource.
```
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
```
The `<link>` tag is most used to link to style sheets
</script>
<aside class="notes" data-markdown>
</aside>
</section>
<section data-markdown>
<script type="text/template">
#### `<style>`
The `<style>` tag is used to define style information for an HTML document.
Inside the `<style>` element you specify how HTML elements should render in a browser:
```
<head>
<style type="text/css">
p { color: #369; }
</style>
</head>
```
</script>
<aside class="notes" data-markdown>
</aside>
</section>
</section>
<section>
<section>
<h2>Indentation & Code formatting</h2>
<ol>
<li class="fragment">I WILL KILL YOU FOR BAD INDENTATION!!!</li>
<li class="fragment">I WILL KILL YOU FOR BAD INDENTATION!!!</li>
<li class="fragment">I WILL KILL YOU FOR BAD INDENTATION!!!</li>
<li class="fragment">DO NOT USE WORD WRAP!!!</li>
<li class="fragment">DO NOT USE WORD WRAP!!!</li>
<li class="fragment">DO NOT USE WORD WRAP!!!</li>
</ol>
</section>
<section>
<h2>Indentation & Code formatting</h2>
<p>We will be using tabs that are 4 spaces long for indentation.</p>
</section>
<section data-markdown>
<script type="text/template">
## Indentation & Code formatting
```
<form action="#" method="get">
<fieldset>
<legend>Login information</legend>
<label for="username">Username</label>
<p><input type="text" name="usr" id="usr" /></p>
<label for="password">Password</label>
<p><input type="text" name="pass" id="pass" /></p>
</fieldset>
```
</script>
</section>
</section>
<section>
<h2>Now, lets write some code</h2>
</section>