Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,440 --> 00:00:02,920
Welcome back.
2
00:00:02,920 --> 00:00:07,040
So, the first thing that we need to learn about HTML is
3
00:00:07,040 --> 00:00:10,110
the common HTML document structure.
4
00:00:10,110 --> 00:00:12,090
So, a structure that each and
5
00:00:12,090 --> 00:00:15,431
every HTML document needs to have.
6
00:00:15,431 --> 00:00:19,410
But let's start by taking a very quick look
7
00:00:19,410 --> 00:00:21,860
at the project that we're going to build
8
00:00:21,860 --> 00:00:23,830
throughout this section.
9
00:00:23,830 --> 00:00:26,770
So, we are building The Code Magazine.
10
00:00:26,770 --> 00:00:30,120
So, as you can see here, and in this Code Magazine,
11
00:00:30,120 --> 00:00:34,827
we are building this very simple kind of blog post called
12
00:00:34,827 --> 00:00:37,460
"The Basic Language of the Web."
13
00:00:37,460 --> 00:00:40,950
So we have some links here, we have images,
14
00:00:40,950 --> 00:00:43,220
We have some bold texts.
15
00:00:43,220 --> 00:00:47,970
We have, here, you see, we have some italic text.
16
00:00:47,970 --> 00:00:49,513
We have lists.
17
00:00:51,507 --> 00:00:54,860
And yeah, so there's a bunch of stuff
18
00:00:54,860 --> 00:00:58,580
that we will learn in this section, so that by the end,
19
00:00:58,580 --> 00:01:01,820
you will have learned the fundamentals of HTML
20
00:01:01,820 --> 00:01:03,973
and we'll end up with this project.
21
00:01:05,280 --> 00:01:09,400
Okay, but anyway, let's now finally get to work.
22
00:01:09,400 --> 00:01:12,190
And the first thing that we need to do again is
23
00:01:12,190 --> 00:01:14,550
to create our project folder.
24
00:01:14,550 --> 00:01:18,710
So, let's go back to our desktop or to where you are working
25
00:01:18,710 --> 00:01:20,370
with your files.
26
00:01:20,370 --> 00:01:23,140
And what I'm going to do is to open up this folder
27
00:01:23,140 --> 00:01:25,753
that we just downloaded in the last section.
28
00:01:26,790 --> 00:01:29,280
So basically, the starter code,
29
00:01:29,280 --> 00:01:33,360
and then I'm going to reach into this starter folder
30
00:01:33,360 --> 00:01:37,770
and grab a copy of the starter files here.
31
00:01:37,770 --> 00:01:42,770
So I will copy this folder and put it on my desktop,
32
00:01:43,010 --> 00:01:44,023
right here.
33
00:01:45,880 --> 00:01:47,390
Now, instead of doing that,
34
00:01:47,390 --> 00:01:51,440
you could also simply go ahead and use this folder here
35
00:01:51,440 --> 00:01:53,420
as your project folder,
36
00:01:53,420 --> 00:01:56,090
but that might lead to some confusions.
37
00:01:56,090 --> 00:01:59,950
So, I always prefer to simply copy this folder here
38
00:01:59,950 --> 00:02:01,053
to somewhere else.
39
00:02:02,760 --> 00:02:05,193
Okay, let's go back to VS code.
40
00:02:06,562 --> 00:02:08,140
I can actually close this.
41
00:02:08,140 --> 00:02:10,780
And then let's come here to the menu,
42
00:02:10,780 --> 00:02:13,843
and then file, and open a new window.
43
00:02:16,810 --> 00:02:19,210
All right, and then right here,
44
00:02:19,210 --> 00:02:21,860
we can select open folder
45
00:02:21,860 --> 00:02:24,860
or we can also expand the sidebar here
46
00:02:24,860 --> 00:02:27,290
and click on open folder right here.
47
00:02:27,290 --> 00:02:30,683
So remember that this will define our project folder.
48
00:02:32,320 --> 00:02:35,680
So I'm going to my desktop and then select this folder
49
00:02:35,680 --> 00:02:37,103
that I just created there.
50
00:02:38,100 --> 00:02:41,403
So open, and there we go.
51
00:02:42,760 --> 00:02:45,300
So, we can close this one now
52
00:02:45,300 --> 00:02:48,123
and push this one to the left side.
53
00:02:50,470 --> 00:02:52,650
This panel we don't need.
54
00:02:52,650 --> 00:02:55,950
And then, here, inside of our project folder,
55
00:02:55,950 --> 00:02:59,460
we can, just like before create a new file,
56
00:02:59,460 --> 00:03:03,900
and we will once again, call it index.html.
57
00:03:03,900 --> 00:03:08,660
So it's just a regular file with the html file extension
58
00:03:08,660 --> 00:03:12,580
and the name of index, which should always be the main page
59
00:03:12,580 --> 00:03:13,893
of any website.
60
00:03:15,820 --> 00:03:18,680
All right, so, as I mentioned before,
61
00:03:18,680 --> 00:03:21,690
we have some images here as our starter files,
62
00:03:21,690 --> 00:03:24,490
and also this text file here.
63
00:03:24,490 --> 00:03:27,880
So let's actually also open up this file
64
00:03:27,880 --> 00:03:29,610
and now, I will click this icon here
65
00:03:29,610 --> 00:03:33,383
to collapse the sidebar to give us some more space.
66
00:03:35,080 --> 00:03:38,950
Okay, now, remember, how in the first section
67
00:03:38,950 --> 00:03:43,950
we use this kind of cheat to create our HTML structure.
68
00:03:43,960 --> 00:03:48,030
So we wrote the exclamation mark, and then type,
69
00:03:48,030 --> 00:03:50,713
and that then gave us all of this structure.
70
00:03:51,610 --> 00:03:54,530
However, to properly learn HTML,
71
00:03:54,530 --> 00:03:56,830
we, of course, need to know how to write
72
00:03:56,830 --> 00:03:59,230
all of this structure on our own.
73
00:03:59,230 --> 00:04:01,840
And so, that should always be the first thing
74
00:04:01,840 --> 00:04:03,473
that we learn in HTML.
75
00:04:04,740 --> 00:04:06,850
So, we start with an empty page,
76
00:04:06,850 --> 00:04:10,480
and then the first thing that we need to do is to declare a
77
00:04:10,480 --> 00:04:12,720
so-called doc type.
78
00:04:12,720 --> 00:04:17,160
So just write the less than symbol, exclamation mark,
79
00:04:17,160 --> 00:04:19,910
and then doc type.
80
00:04:19,910 --> 00:04:23,530
And to see that a VS code is actually trying to auto
81
00:04:23,530 --> 00:04:25,400
complete this here for us,
82
00:04:25,400 --> 00:04:28,090
but let's just write it all by hand
83
00:04:29,500 --> 00:04:34,500
so that this code basically sticks in your memory, okay.
84
00:04:34,740 --> 00:04:39,520
So we have to write an exclamation mark, doc type HTML in
85
00:04:39,520 --> 00:04:43,600
order to basically tell the browser that this document uses
86
00:04:43,600 --> 00:04:48,600
HTML. Next up, we need to create a HTML element.
87
00:04:48,860 --> 00:04:52,860
So remember from the last lecture that to create an element
88
00:04:52,860 --> 00:04:55,750
again, we use the less than symbol,
89
00:04:55,750 --> 00:05:00,490
then the name of the element, which in this case is HTML,
90
00:05:00,490 --> 00:05:02,520
and then we close that.
91
00:05:02,520 --> 00:05:04,000
And once again,
92
00:05:04,000 --> 00:05:08,300
a VS code automatically now closes that element for us.
93
00:05:08,300 --> 00:05:11,660
So it created a disclosing tag.
94
00:05:11,660 --> 00:05:13,450
Now, in case you don't want that,
95
00:05:13,450 --> 00:05:16,616
you can actually turn off that functionality and
96
00:05:16,616 --> 00:05:18,820
let me show you how.
97
00:05:18,820 --> 00:05:21,460
So again, you come here to the settings
98
00:05:21,460 --> 00:05:23,740
and then the name of this setting is called
99
00:05:25,362 --> 00:05:27,523
auto close tags.
100
00:05:28,490 --> 00:05:31,460
And actually I will turn this off for now
101
00:05:31,460 --> 00:05:34,690
so that you can really write this code by hand
102
00:05:34,690 --> 00:05:37,853
instead of having VS code helping you.
103
00:05:39,010 --> 00:05:41,970
So we will turn this back on a bit later, but for now,
104
00:05:41,970 --> 00:05:44,830
I really want you to learn how to write these elements
105
00:05:44,830 --> 00:05:47,680
by hand, without any help now.
106
00:05:47,680 --> 00:05:51,160
Okay, So we have the opening and the closing tag
107
00:05:51,160 --> 00:05:55,300
of the HTML element. And now as for the content,
108
00:05:55,300 --> 00:05:58,760
we will actually put another element inside it.
109
00:05:58,760 --> 00:06:02,230
So let's give ourselves some space here.
110
00:06:02,230 --> 00:06:07,230
And then inside of the HTML, we want first a head element.
111
00:06:08,920 --> 00:06:12,330
So let's write it, opening and
112
00:06:12,330 --> 00:06:14,750
I will then immediately close it actually,
113
00:06:14,750 --> 00:06:17,463
because for now we will not put any content in there.
114
00:06:19,552 --> 00:06:20,560
Okay.
115
00:06:20,560 --> 00:06:23,420
So the head and then, the body.
116
00:06:23,420 --> 00:06:25,010
And I will explain in a second,
117
00:06:25,010 --> 00:06:27,093
what each of these actually is.
118
00:06:29,900 --> 00:06:34,370
So each and every HTML document always needs to start
119
00:06:34,370 --> 00:06:37,960
with the HTML element like this.
120
00:06:37,960 --> 00:06:41,310
Then inside of this element, as we just put,
121
00:06:41,310 --> 00:06:44,873
we need one head element and one body element.
122
00:06:45,760 --> 00:06:49,040
Now the head element is basically for things
123
00:06:49,040 --> 00:06:52,380
that are not visible in the browser window.
124
00:06:52,380 --> 00:06:55,630
So this head will contain the page title,
125
00:06:55,630 --> 00:06:58,710
some additional information about the page,
126
00:06:58,710 --> 00:07:02,490
link to CSS files or other things.
127
00:07:02,490 --> 00:07:03,980
And as we go through the course,
128
00:07:03,980 --> 00:07:07,550
we will fill this head with all kinds of different elements.
129
00:07:07,550 --> 00:07:11,663
But for now, all I want to do is to just specify the title.
130
00:07:13,530 --> 00:07:15,723
So let's use the title element for that.
131
00:07:16,680 --> 00:07:18,360
And this page, I want to call
132
00:07:18,360 --> 00:07:23,033
'The Basic Language of the Web'
133
00:07:25,383 --> 00:07:26,760
HTML.
134
00:07:26,760 --> 00:07:29,500
So basically that's the title here of
135
00:07:29,500 --> 00:07:31,700
this blog post as well.
136
00:07:31,700 --> 00:07:35,563
Okay. At then, we need a closing tag of this element.
137
00:07:37,865 --> 00:07:39,323
Okay.
138
00:07:41,030 --> 00:07:44,920
Then the body is actually for all the elements
139
00:07:44,920 --> 00:07:47,630
that will be visible on the page.
140
00:07:47,630 --> 00:07:51,210
So all the elements that we see here in the browser
141
00:07:51,210 --> 00:07:55,180
will always be inside of the body element.
142
00:07:55,180 --> 00:07:58,970
And just to show it to you, instead of leaving it empty,
143
00:07:58,970 --> 00:08:01,400
let me put some code here.
144
00:08:01,400 --> 00:08:04,620
So I will again use the heading one element.
145
00:08:04,620 --> 00:08:08,713
So H1 that we used in the very first coding lecture,
146
00:08:09,720 --> 00:08:12,773
and let me just grab this text from here.
147
00:08:15,000 --> 00:08:18,340
So that's the content that then again,
148
00:08:18,340 --> 00:08:21,420
closing it, all right.
149
00:08:21,420 --> 00:08:25,580
Now, we haven't saved this file yet, but as we do
150
00:08:25,580 --> 00:08:29,070
prettier will again format this file for us.
151
00:08:29,070 --> 00:08:32,690
So let's give it a save and you see that now we have the
152
00:08:32,690 --> 00:08:34,530
correct indentation.
153
00:08:34,530 --> 00:08:37,660
And by indentation, what I mean is that
154
00:08:37,660 --> 00:08:40,010
since this head element, for example,
155
00:08:40,010 --> 00:08:42,220
is inside the HTML,
156
00:08:42,220 --> 00:08:45,160
it should have some space here to make that
157
00:08:45,160 --> 00:08:47,110
visually obvious.
158
00:08:47,110 --> 00:08:50,400
Okay, so basically this is just a tab here.
159
00:08:50,400 --> 00:08:52,050
So if I hit the tab key,
160
00:08:52,050 --> 00:08:55,400
then it will add another level of indentation.
161
00:08:55,400 --> 00:08:58,450
And so now it's at the same level as the title,
162
00:08:58,450 --> 00:09:00,970
which doesn't make sense because the title
163
00:09:00,970 --> 00:09:04,960
is also inside of the head, right?
164
00:09:04,960 --> 00:09:09,440
So we have the head inside of HTML and then inside of the
165
00:09:09,440 --> 00:09:11,720
head, we have the title element.
166
00:09:11,720 --> 00:09:15,270
And so therefore it has another level of indentation.
167
00:09:15,270 --> 00:09:16,240
Okay.
168
00:09:16,240 --> 00:09:18,740
Now this is just for aesthetic reasons to
169
00:09:18,740 --> 00:09:20,900
make our code more readable.
170
00:09:20,900 --> 00:09:24,400
So the browser really doesn't care about this indentation,
171
00:09:24,400 --> 00:09:25,960
but it is still important for us
172
00:09:25,960 --> 00:09:27,703
to be able to read the code.
173
00:09:28,960 --> 00:09:29,793
So again,
174
00:09:29,793 --> 00:09:33,350
let's give it a save and I think we are ready now to
175
00:09:33,350 --> 00:09:37,183
actually go ahead and open this in the browser.
176
00:09:38,730 --> 00:09:42,800
So let's come to our project folder and then double click
177
00:09:42,800 --> 00:09:47,800
index.HTML, and nice, here it is.
178
00:09:48,140 --> 00:09:51,340
Let's put it here first, close up this one,
179
00:09:51,340 --> 00:09:54,980
but I will also leave this demo open just
180
00:09:54,980 --> 00:09:57,513
so we see what we want to achieve in the end.
181
00:09:59,290 --> 00:10:02,050
Okay, that's close up this one here.
182
00:10:02,050 --> 00:10:06,840
And with this, we learned the basic structure of HTML.
183
00:10:06,840 --> 00:10:08,853
So let's just quickly review.
184
00:10:09,740 --> 00:10:13,140
So every HTML document always needs to start with these
185
00:10:13,140 --> 00:10:14,790
so-called doc type.
186
00:10:14,790 --> 00:10:17,580
And so this will let the browser know that we are actually
187
00:10:17,580 --> 00:10:22,460
using HTML in this file and all browsers will then know
188
00:10:22,460 --> 00:10:26,030
that they should use the HTML five specification to
189
00:10:26,030 --> 00:10:27,970
render this HTML.
190
00:10:27,970 --> 00:10:30,380
Then we have the HTML element,
191
00:10:30,380 --> 00:10:35,380
which is always the parent element of both the head and of
192
00:10:35,450 --> 00:10:36,860
the body element.
193
00:10:36,860 --> 00:10:39,760
So this structure is really always the same
194
00:10:39,760 --> 00:10:41,520
in all web pages.
195
00:10:41,520 --> 00:10:45,330
We always need to have an HTML element with a head
196
00:10:45,330 --> 00:10:47,000
and with a body.
197
00:10:47,000 --> 00:10:51,080
Now, what we put into the head and the body is optional,
198
00:10:51,080 --> 00:10:54,030
but having these two is not optional.
199
00:10:54,030 --> 00:10:56,413
So we always need head and body.
200
00:10:57,310 --> 00:10:58,480
Now in this situation,
201
00:10:58,480 --> 00:11:01,970
all we put in the head is just a title element,
202
00:11:01,970 --> 00:11:04,780
but here we can put all kinds of other stuff
203
00:11:04,780 --> 00:11:06,790
that are not visible,
204
00:11:06,790 --> 00:11:09,310
or that are not rendered here
205
00:11:09,310 --> 00:11:11,970
in this main part of the browser.
206
00:11:11,970 --> 00:11:13,020
On the other hand,
207
00:11:13,020 --> 00:11:16,200
the content that we actually want to be rendered here
208
00:11:16,200 --> 00:11:18,640
should go into the body.
209
00:11:18,640 --> 00:11:21,618
And so that's why having this H1 element here,
210
00:11:21,618 --> 00:11:25,500
then it appears to be visible on the page.
211
00:11:25,500 --> 00:11:27,380
Okay, and that's it,
212
00:11:27,380 --> 00:11:31,320
that's the basic HTML structure for each and every HTML
213
00:11:31,320 --> 00:11:33,960
document that you really need to know.
214
00:11:33,960 --> 00:11:34,900
And with that,
215
00:11:34,900 --> 00:11:38,390
let's move on to the next lecture where we will learn a
216
00:11:38,390 --> 00:11:42,100
couple of new elements for working with text.
217
00:11:42,100 --> 00:11:43,903
So I hope to see you there soon.
16034
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.