Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,360 --> 00:00:05,820
So I mentioned the term semantic HTML a couple of times
2
00:00:05,820 --> 00:00:07,230
in this section.
3
00:00:07,230 --> 00:00:10,670
And so let's now actually very quickly define what I
4
00:00:10,670 --> 00:00:13,763
actually mean by semantic HTML.
5
00:00:15,320 --> 00:00:18,890
So in HTML, when we talk about semantics,
6
00:00:18,890 --> 00:00:22,720
what we mean is that certain elements have actually
7
00:00:22,720 --> 00:00:26,330
a meaning or a purpose attached to them.
8
00:00:26,330 --> 00:00:29,870
So when we think about a certain HTML element,
9
00:00:29,870 --> 00:00:33,270
we should actually not think about what that element looks
10
00:00:33,270 --> 00:00:35,810
like as it's rendered on the page.
11
00:00:35,810 --> 00:00:38,950
But instead we should think about what that element
12
00:00:38,950 --> 00:00:42,410
actually means and what it stands for.
13
00:00:42,410 --> 00:00:46,890
So that is basically the definition of semantic HTML.
14
00:00:46,890 --> 00:00:50,760
Now, not all elements in HTML are semantic.
15
00:00:50,760 --> 00:00:54,970
And actually I talked a little bit about that before
16
00:00:54,970 --> 00:00:58,250
here in this element. So the strong element,
17
00:00:58,250 --> 00:01:02,750
which makes our element look bold here on the page.
18
00:01:02,750 --> 00:01:07,010
So remember how previously I used the B element,
19
00:01:07,010 --> 00:01:09,920
which simply turns its content bold,
20
00:01:09,920 --> 00:01:13,150
but doesn't attach it any meaning. Right?
21
00:01:13,150 --> 00:01:15,010
So I explained that before.
22
00:01:15,010 --> 00:01:17,523
And so now maybe it makes a bit more sense.
23
00:01:18,360 --> 00:01:21,760
So again, by using the strong element here,
24
00:01:21,760 --> 00:01:25,420
the text will still look bold here in the browser,
25
00:01:25,420 --> 00:01:28,640
but what really matters here is that we now assign some
26
00:01:28,640 --> 00:01:31,050
meaning to this content here.
27
00:01:31,050 --> 00:01:33,800
We now say that is a strong content,
28
00:01:33,800 --> 00:01:38,000
which means basically a very important piece of content and
29
00:01:38,000 --> 00:01:43,000
the same here for this piece. So this fundamental word here.
30
00:01:43,840 --> 00:01:48,280
So again, we use EM for emphasizing this.
31
00:01:48,280 --> 00:01:52,230
And so it still looks atelic here on the webpage,
32
00:01:52,230 --> 00:01:56,160
but what we really mean is that we emphasized this word
33
00:01:56,160 --> 00:02:01,030
here. So we gave it a special emphasis and yeah,
34
00:02:01,030 --> 00:02:04,373
that's what this element here right now means.
35
00:02:05,450 --> 00:02:09,000
Okay, and the same is actually true for
36
00:02:09,000 --> 00:02:12,420
all of these elements that we used in the last video.
37
00:02:12,420 --> 00:02:15,640
So for example here, this navigation element,
38
00:02:15,640 --> 00:02:17,800
all this does is to create a box,
39
00:02:17,800 --> 00:02:22,160
remember which then contains these four anchor elements,
40
00:02:22,160 --> 00:02:25,060
but visually it doesn't really do anything.
41
00:02:25,060 --> 00:02:28,310
All this does is to represent as a meaning
42
00:02:28,310 --> 00:02:32,330
that this is a navigation, but instead of using nav,
43
00:02:32,330 --> 00:02:35,640
we could also have used a more generic element,
44
00:02:35,640 --> 00:02:38,240
which is the div element.
45
00:02:38,240 --> 00:02:43,240
So for example, div open and close it here, and again,
46
00:02:43,610 --> 00:02:46,210
visually nothing will change.
47
00:02:46,210 --> 00:02:49,320
And so all this did was to create a new box,
48
00:02:49,320 --> 00:02:51,780
but the box without any meaning.
49
00:02:51,780 --> 00:02:53,883
So that's what div stands for.
50
00:02:54,760 --> 00:02:57,430
So back in the day before HTML five,
51
00:02:57,430 --> 00:03:00,980
we always use divs for every single box that we needed
52
00:03:00,980 --> 00:03:03,180
like this on the page,
53
00:03:03,180 --> 00:03:07,940
but then HTML five came around and introduced this concept
54
00:03:07,940 --> 00:03:09,700
of semantic HTML.
55
00:03:09,700 --> 00:03:13,040
And so now we should only use the div element when we don't
56
00:03:13,040 --> 00:03:16,920
want to attach a certain meaning to a certain container.
57
00:03:16,920 --> 00:03:20,463
So to a certain like box element on our page.
58
00:03:21,310 --> 00:03:22,143
So in this case,
59
00:03:22,143 --> 00:03:25,760
we really want this to mean that it's a navigation.
60
00:03:25,760 --> 00:03:30,510
And so we use the navigation element for that.
61
00:03:30,510 --> 00:03:34,623
Okay. And the same is true for the article, the header,
62
00:03:36,200 --> 00:03:38,223
the footer that we have down here.
63
00:03:39,220 --> 00:03:43,690
And in fact it is true even for the paragraph,
64
00:03:43,690 --> 00:03:46,610
for example, because all that,
65
00:03:46,610 --> 00:03:51,040
this paragraph here and all the other paragraphs really are,
66
00:03:51,040 --> 00:03:54,820
are essentially boxes filled with text.
67
00:03:54,820 --> 00:03:58,370
Now the P of course does have a semantic meaning.
68
00:03:58,370 --> 00:04:00,630
It means that it is a paragraph,
69
00:04:00,630 --> 00:04:05,420
but we could again use a generic box without any meaning.
70
00:04:05,420 --> 00:04:09,213
So the div and nothing would change visually.
71
00:04:11,560 --> 00:04:14,300
Okay. Actually something did change here.
72
00:04:14,300 --> 00:04:17,430
So we lost some of the white space that
73
00:04:17,430 --> 00:04:19,283
we do have around the P.
74
00:04:20,890 --> 00:04:23,790
All right, so let's put it back here anyway
75
00:04:23,790 --> 00:04:27,650
to the P because we want it to have some meaning.
76
00:04:27,650 --> 00:04:30,740
And of course we also want the spacing that's the browser
77
00:04:30,740 --> 00:04:34,250
gives us by default around the P elements.
78
00:04:34,250 --> 00:04:38,940
Now okay, but the idea that I mentioned still holds
79
00:04:38,940 --> 00:04:42,590
because we could very easily recreate this space here
80
00:04:42,590 --> 00:04:44,770
using some CSS later.
81
00:04:44,770 --> 00:04:46,120
So if we wanted,
82
00:04:46,120 --> 00:04:50,380
we could in fact build the entire webpage only out of div
83
00:04:50,380 --> 00:04:52,300
elements if we wanted and
84
00:04:52,300 --> 00:04:56,120
then use CSS to style them as we want.
85
00:04:56,120 --> 00:04:58,300
But of course we don't do that.
86
00:04:58,300 --> 00:05:01,993
We use semantic HTML to give four elements meaning.
87
00:05:02,870 --> 00:05:05,670
Now you might ask why we actually do that
88
00:05:05,670 --> 00:05:07,690
and there are multiple reasons.
89
00:05:07,690 --> 00:05:11,320
And I think I mentioned them already, actually.
90
00:05:11,320 --> 00:05:14,770
So one of them is a search engine optimization,
91
00:05:14,770 --> 00:05:17,995
which basically means that a search engine such as Google
92
00:05:17,995 --> 00:05:22,040
will be able to understand the structure of your content.
93
00:05:22,040 --> 00:05:25,390
And therefore they will be better able to analyze
94
00:05:25,390 --> 00:05:29,120
what your content and what your webpage is all about.
95
00:05:29,120 --> 00:05:33,280
Also writing semantic HTML is extremely important for
96
00:05:33,280 --> 00:05:36,250
accessibility and especially for people
97
00:05:36,250 --> 00:05:41,090
who rely on screen readers to consume on web pages.
98
00:05:41,090 --> 00:05:44,280
Okay, so I hope that this makes sense,
99
00:05:44,280 --> 00:05:47,380
and we will also keep touching on the subject
100
00:05:47,380 --> 00:05:50,230
as we go through the rest of the course,
101
00:05:50,230 --> 00:05:53,050
but I still wanted to make it very clear from the very
102
00:05:53,050 --> 00:05:56,160
beginning that when we think about HTML,
103
00:05:56,160 --> 00:05:59,170
we should not only think about how it actually looks like
104
00:05:59,170 --> 00:06:00,200
in the browser,
105
00:06:00,200 --> 00:06:03,800
but even more about what these elements actually mean
106
00:06:03,800 --> 00:06:05,760
and what they stand for.
107
00:06:05,760 --> 00:06:07,630
And with that being said,
108
00:06:07,630 --> 00:06:11,560
we kind of finished all we had to learn in this section.
109
00:06:11,560 --> 00:06:13,490
And so in the next video,
110
00:06:13,490 --> 00:06:16,714
we will configure vs code a little bit more,
111
00:06:16,714 --> 00:06:20,320
and then we will move on to two final challenges
112
00:06:20,320 --> 00:06:21,520
in the section.
113
00:06:21,520 --> 00:06:25,483
So don't wait and let's move on to the next lecture here.
8812
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.