You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expand this tutorial based on confused areas last night.
There were a couple of typos in this tutorial, as well as some parts
which tripped up the students I worked with last night. I've cleaned
those typos up, added some explanations for confusing bits, removed some
technical language in favour of plain English, and simplified some other
sections.
Copy file name to clipboardExpand all lines: html/lesson1/tutorial.md
+51-26Lines changed: 51 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ We will be building this [example page](http://codebar.github.io/tutorials/html/
33
33
34
34
### HTML element anatomy
35
35
36
-
An **element** is an HTML component _eg. paragraph, heading, table, list etc_
36
+
An **element** is an HTML building block. There are paragraphs, headings, tables, links, lists, and many more.
37
37
38
-
**Tags**, mark the opening and closing of an element. They contain elements that show their purpose
38
+
**Tags** mark the opening and closing of an element. They often contain other elements and text.
39
39
40
40
`<tagname>some content</tagname>`
41
41
@@ -44,13 +44,21 @@ An **element** is an HTML component _eg. paragraph, heading, table, list etc_
44
44
<h1>I am a heading</h1>
45
45
```
46
46
47
-
Some elements are standalone, as they cannot contain anything else<tagname/>
47
+
Some elements are standalone, as they cannot contain anything else. They look like this: `<tagname/>`
48
48
49
49
```html
50
50
<br/>
51
51
<img/>
52
52
```
53
53
54
+
### Comments
55
+
56
+
We can use a special kind of tag to add notes to our page. The computer will ignore them, but programmers can read them and understand how your code works.
57
+
58
+
```html
59
+
<!-- Note to self: this is where the header goes -->
60
+
```
61
+
54
62
### DOCTYPE and HTML tags
55
63
56
64
The doctype is the first thing that must be defined in an HTML page.
@@ -81,7 +89,7 @@ The **body** contains what is visible to the user.
81
89
82
90
## Let's get started!
83
91
84
-
Let's start by defining the basic structure of our website.
92
+
Let's start by defining the basic structure of our website. Create a new folder for your work called "HTML tutorial 1". Then create a new file called "index.html" in that folder. Here's what you should put in it:
85
93
86
94
```html
87
95
<!DOCTYPE html>
@@ -90,11 +98,16 @@ Let's start by defining the basic structure of our website.
90
98
<title>I love owls</title>
91
99
</head>
92
100
<body>
93
-
<!-- content -->
101
+
<!--Put your page content in this body tag!-->
94
102
</body>
95
103
</html>
96
104
```
97
105
106
+
> If you load this in your browser, do you see anything on the page?
107
+
108
+
> What about in the browser's title bar or tab bar?
109
+
110
+
98
111
### Element: Heading
99
112
100
113
Headings come in many sizes
@@ -106,7 +119,7 @@ Headings come in many sizes
106
119
##### `<h5>Heading</h5>`
107
120
###### `<h6>Heading</h6>`
108
121
109
-
Add a heading to your page
122
+
Add a heading to your page. Place it inside the page body.
110
123
111
124
```html
112
125
<h1>Owls!</h1>
@@ -126,7 +139,7 @@ Elements can be nested inside each other. For example, by putting the `<h1>` ins
126
139
127
140
Putting content into a `<p>` will make it look like a paragraph structure. This helps make the content of a page easier to read.
128
141
129
-
Add the following to your page, after the title
142
+
Add the following to your page body, after the `<h1>` heading:
130
143
131
144
```html
132
145
<p>
@@ -179,10 +192,11 @@ Let's add a link to the bottom of our paragraph
179
192
180
193
### Element: Div `<div>`
181
194
182
-
Div stands for _division_. It creates sections in an HTML document.
183
-
We can use a div to contain out paragraph.
195
+
Div stands for _division_. It creates sections in an HTML document. They don't affect the layout of your page - but they do help you group related elements together.
184
196
185
-
Wrap your paragraph in a div and add a heading to it
197
+
We can use a div to contain our paragraph.
198
+
199
+
Wrap your existing paragraph in a div and add a new heading to it:
186
200
187
201
```html
188
202
<div>
@@ -198,6 +212,7 @@ Wrap your paragraph in a div and add a heading to it
198
212
</div>
199
213
```
200
214
215
+
201
216
### Element: List `<li>`
202
217
203
218
There are two types of lists, **ordered** and **unordered**.
@@ -214,9 +229,11 @@ Let's list the reasons we like owls so much under the main heading of the page (
214
229
</ol>
215
230
```
216
231
232
+
> If you wanted to make this an unordered list, what would you change? How could you check it worked? Try it, then change your list back to an ordered list.
233
+
217
234
### Element: Image `<img>`
218
235
219
-
So far we've learned a lot about how to add text to our page. But how about some media?
236
+
So far we've learned a lot about how to add text to our page. But how about something to look at?
220
237
221
238
Let's add some images!
222
239
@@ -234,7 +251,7 @@ Images are primarily made up of three attributes
234
251
235
252
* the `<img>` tag
236
253
* the `src` attribute, which lets the page know what image we want to view
237
-
* the `alt` attribute, where we describe our image
254
+
* the `alt` attribute, where we describe our image for people who can't see it
238
255
239
256
Before the main heading of the page, add the following
240
257
@@ -244,10 +261,14 @@ Before the main heading of the page, add the following
244
261
</div>
245
262
```
246
263
264
+
> Remember: the `<head>` section is not the same as a heading! Make sure your new `<div>` is in the page body.
265
+
247
266
> Can you see the codebar logo? What happens when you change logo to logo1?
248
267
249
-
Let's add some more, this time, contained in a list.
250
-
Do this underneath `<h2>Why do I like owls so much?</h2>`
268
+
> If you can't see your image, make sure you put it in the `images` folder.
269
+
270
+
Let's add some more images. This time, we'll put them in a list.
271
+
Do this underneath the `<h2>Why do I like owls so much?</h2>` heading.
251
272
252
273
```html
253
274
<ul>
@@ -261,11 +282,11 @@ So a list can not only contain text, but other elements as well.
261
282
262
283
### Adding a link on multiple elements
263
284
264
-
Links can contain not just text, but images or even a number of elements within.
285
+
Links can contain many elements - not just text.
265
286
266
-
Let's link some pictures and text to a video. It can be handy when we want the user to get to where we want them without needing to click on text.
287
+
Let's use some pictures and text to link to a video. It can be handy when we want the user to get to where we want them without needing to click on text.
267
288
268
-
Add that underneath the ordered list we defined earlier.
289
+
Add this underneath the ordered list about why we like owls.
269
290
270
291
```html
271
292
<div>
@@ -279,31 +300,35 @@ Add that underneath the ordered list we defined earlier.
279
300
```
280
301
281
302
> Click any of the images. Can you get to the link's page?
303
+
> What happens if you take the `<br/>` tag out? Remember to put it back afterwards!
304
+
305
+
### Special characters and more formatting
306
+
307
+
Some characters have special meaning in HTML. For instance, we use < and > to make HTML tags, and we use " to wrap our attributes. But what if we wanted to use those characters in our page?
282
308
283
-
### ASCII and more formatting
309
+
One way is to use **HTML entities**. These have an ampersand, a name, then a semicolon. Here's the HTML entity for a quote character: `"`.
284
310
285
-
**ASCII** code is a way to represent text in ways that all computers can understand.
286
-
[Here](http://htmlandcssbook.com/extras/html-escape-codes/) is a list with codes, their representation and HTML number.
311
+
You can also use a numerical format to produce special characters. [Here's a list](http://htmlandcssbook.com/extras/html-escape-codes/) of some common entities.
287
312
288
-
Add a small rhyme to your page, wrapped with quotes using ASCII code.
313
+
Add a small rhyme to your page, wrapped with quotes using HTML entities.
289
314
290
315
```html
291
316
<div>
292
317
<p>
293
318
<strong>
294
319
<em>
295
-
"A wise old owl sat on an oak; The more he saw the less he spoke; <br>
296
-
The less he spoke the more he heard; Why aren't we like that wise old bird?"
320
+
"A wise old owl sat on an oak; The more he saw the less he spoke; <br>
321
+
The less he spoke the more he heard; Why aren't we like that wise old bird?"
297
322
</em>
298
323
</strong>
299
324
</p>
300
-
<small>- nursery rhyme</small>
325
+
<small>— nursery rhyme</small>
301
326
</div>
302
327
```
303
328
304
329
**small** is another html formatting element you can use.
305
330
306
-
> Have you noticed how the character `"` renders on the page?
331
+
> Have you noticed how the character `—` renders on the page?
307
332
308
333
### mailto links `<a>`
309
334
@@ -323,7 +348,7 @@ The difference between links and mailto links, is the content defined in the **h
323
348
324
349
> What happens when you click the first link?
325
350
326
-
> What happens when you click the second link?
351
+
> What happens when you click the second link? How is it different?
327
352
328
353
> What happens when you add `&body=Owls are amazing` to the second link?
0 commit comments