Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,006 --> 00:00:03,005
- Before we go into more HTML elements,
2
00:00:03,005 --> 00:00:04,003
I want to make sure you know
3
00:00:04,003 --> 00:00:08,003
how to inspect HTML in a browser developer tools.
4
00:00:08,003 --> 00:00:10,009
In all of today's desktop browsers,
5
00:00:10,009 --> 00:00:13,007
there's a secret cockpit of information about
6
00:00:13,007 --> 00:00:17,001
what's happening with a website's code and performance.
7
00:00:17,001 --> 00:00:19,004
Let's look at them in Firefox.
8
00:00:19,004 --> 00:00:21,008
Here I've got a demo in Codepen
9
00:00:21,008 --> 00:00:28,006
that combines a lot of the HTML elements that we've learned.
10
00:00:28,006 --> 00:00:31,005
I'll open this Codepen demo up in a new tab,
11
00:00:31,005 --> 00:00:34,001
so we just have the demo and not all the parts
12
00:00:34,001 --> 00:00:35,007
for the Codepen website.
13
00:00:35,007 --> 00:00:40,000
Now, I'll right-click on this and go to inspect element,
14
00:00:40,000 --> 00:00:47,000
or instead we can go to tools, web developer, inspector.
15
00:00:47,000 --> 00:00:49,005
This opens the developer tools.
16
00:00:49,005 --> 00:00:52,006
Across the top here, there are a bunch of other tabs
17
00:00:52,006 --> 00:00:55,000
with page after page of different tools.
18
00:00:55,000 --> 00:00:58,005
Like I said, it's a cockpit of controls.
19
00:00:58,005 --> 00:01:00,007
But let's ignore all that, and let's just look
20
00:01:00,007 --> 00:01:02,007
at the inspector.
21
00:01:02,007 --> 00:01:05,001
We've got three panes here.
22
00:01:05,001 --> 00:01:09,004
On the left is the HTML, the middle is for CSS
23
00:01:09,004 --> 00:01:12,003
and the right pane has several more options.
24
00:01:12,003 --> 00:01:16,004
You can click on more tabs here and see the layout tools,
25
00:01:16,004 --> 00:01:19,001
the list of any changes you've made to CSS
26
00:01:19,001 --> 00:01:21,009
and a pane about fonts.
27
00:01:21,009 --> 00:01:23,009
But we aren't going to think about this right pane
28
00:01:23,009 --> 00:01:29,008
or this middle pane for CSS right now.
29
00:01:29,008 --> 00:01:34,005
Let's just look at the left pane, this is our HTML.
30
00:01:34,005 --> 00:01:37,002
I can see here the DOM that the browser has created,
31
00:01:37,002 --> 00:01:39,004
the Document Object Model.
32
00:01:39,004 --> 00:01:42,003
Firefox read the HTML that I sent it,
33
00:01:42,003 --> 00:01:44,005
and then it revised it, it tried its best
34
00:01:44,005 --> 00:01:46,004
to fix any mistakes that I might have had,
35
00:01:46,004 --> 00:01:49,008
and created its own version, the DOM version.
36
00:01:49,008 --> 00:01:53,002
We can see what the headline Bees is wrapped in an h1,
37
00:01:53,002 --> 00:01:56,004
and below that, Beekeeping is an h2,
38
00:01:56,004 --> 00:01:59,000
and then we can see that there are two paragraphs.
39
00:01:59,000 --> 00:02:02,003
We see a p element, but instead of the words
40
00:02:02,003 --> 00:02:05,004
in the paragraph, it just says, "..."
41
00:02:05,004 --> 00:02:08,002
and there's a little triangle right here,
42
00:02:08,002 --> 00:02:09,007
you can turn these triangles
43
00:02:09,007 --> 00:02:12,004
and reveal what's inside.
44
00:02:12,004 --> 00:02:15,009
I can see in the second paragraph, there's a sup element
45
00:02:15,009 --> 00:02:17,008
around the number for the footnote.
46
00:02:17,008 --> 00:02:21,002
Further down, I can see a pre element
47
00:02:21,002 --> 00:02:24,000
and a block quote, inside the block quote
48
00:02:24,000 --> 00:02:25,005
I have a cite element.
49
00:02:25,005 --> 00:02:27,006
The inspector is representing the DOM tree here,
50
00:02:27,006 --> 00:02:29,004
the family tree of elements,
51
00:02:29,004 --> 00:02:31,001
and that's going to be very useful.
52
00:02:31,001 --> 00:02:34,008
Many browsers have developer tools, Safari, Chrome, Edge,
53
00:02:34,008 --> 00:02:37,009
and they all have an HTML panel that's just like this one.
54
00:02:37,009 --> 00:02:39,009
They use the same way of indenting things
55
00:02:39,009 --> 00:02:41,003
and using these little triangles
56
00:02:41,003 --> 00:02:43,001
to make sense of the DOM tree.
57
00:02:43,001 --> 00:02:45,006
We can use developer tools to inspect any website
58
00:02:45,006 --> 00:02:47,009
on the internet, and peek under the hood
59
00:02:47,009 --> 00:02:49,007
to see how other developers use HTML.
60
00:02:49,007 --> 00:02:51,006
This is how I get ideas when I'm not sure
61
00:02:51,006 --> 00:02:54,005
what markup to use, I'll go to other websites,
62
00:02:54,005 --> 00:02:56,006
find some content that's similar to the content I'm trying
63
00:02:56,006 --> 00:02:58,006
to markup, and use the developer tools
64
00:02:58,006 --> 00:03:01,000
to find out what elements they used.
65
00:03:01,000 --> 00:03:02,006
Especially if the website was built by a team
66
00:03:02,006 --> 00:03:04,006
that I respect, looking at other peoples work
67
00:03:04,006 --> 00:03:06,008
can help me to better understand how
68
00:03:06,008 --> 00:03:08,001
to structure my own HTML.
69
00:03:08,001 --> 00:03:10,003
You can also use HTML inspector in dev tools
70
00:03:10,003 --> 00:03:12,002
to help us debug mistakes.
71
00:03:12,002 --> 00:03:15,004
Let's look at some code that has something wrong with it.
72
00:03:15,004 --> 00:03:18,006
Here I have an unordered list with four items,
73
00:03:18,006 --> 00:03:21,003
and they should be counting off one, two, three, four,
74
00:03:21,003 --> 00:03:24,004
but if you look at the results there's a blank one,
75
00:03:24,004 --> 00:03:29,004
and it throws off the counting, we get five items, so why?
76
00:03:29,004 --> 00:03:31,005
Well, let's right click on this
77
00:03:31,005 --> 00:03:33,009
and look at it in the developer tools
78
00:03:33,009 --> 00:03:37,005
we can see that in fact the browser is doing something
79
00:03:37,005 --> 00:03:40,002
to repair the HTML that it received
80
00:03:40,002 --> 00:03:41,004
when it built the DOM tree.
81
00:03:41,004 --> 00:03:44,005
And it thinks that there should be five items,
82
00:03:44,005 --> 00:03:51,005
one, two, empty, three, four,
83
00:03:51,005 --> 00:03:53,007
so what's going on?
84
00:03:53,007 --> 00:03:55,009
Well I can see that there's something going wrong
85
00:03:55,009 --> 00:03:59,009
before what should be the third item,
86
00:03:59,009 --> 00:04:03,001
and I know the browser is adding more tags,
87
00:04:03,001 --> 00:04:05,006
it's adding an extra pair of tags.
88
00:04:05,006 --> 00:04:08,004
Let's look back at my original HTML
89
00:04:08,004 --> 00:04:11,004
and somewhere before the third term,
90
00:04:11,004 --> 00:04:17,000
oh I see, it, I told the browser to start another list item
91
00:04:17,000 --> 00:04:20,007
right here instead of telling it end one,
92
00:04:20,007 --> 00:04:23,002
so let's fix that.
93
00:04:23,002 --> 00:04:26,000
If I put the slash where it's missing,
94
00:04:26,000 --> 00:04:30,003
we can see now that it works, the DOM is fixed.
95
00:04:30,003 --> 00:04:32,005
Any time you aren't sure what's going on, reach
96
00:04:32,005 --> 00:04:37,000
for the developer tools in a browser to sort things out.
7281
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.