Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,350 --> 00:00:03,520
Now another very important skill
2
00:00:03,520 --> 00:00:06,780
that you will need as you become a web developer
3
00:00:06,780 --> 00:00:11,300
is to debug your own code and to ask questions in case
4
00:00:11,300 --> 00:00:13,633
that you cannot solve certain problems.
5
00:00:15,290 --> 00:00:16,560
So in programming,
6
00:00:16,560 --> 00:00:21,560
we say that a bug is basically an error or a mistake.
7
00:00:21,660 --> 00:00:26,190
And so basically debugging our code means finding and fixing
8
00:00:26,190 --> 00:00:28,400
errors in code.
9
00:00:28,400 --> 00:00:29,550
All right.
10
00:00:29,550 --> 00:00:34,190
So let's now pretend that there is some error in your code
11
00:00:34,190 --> 00:00:37,230
and in HTML, the most common error,
12
00:00:37,230 --> 00:00:42,150
so the most common bug that occurs, is that some elements
13
00:00:42,150 --> 00:00:43,653
remain unclosed.
14
00:00:44,560 --> 00:00:47,960
So that can easily happen even with VS Code
15
00:00:47,960 --> 00:00:50,820
automatically closing elements for us,
16
00:00:50,820 --> 00:00:54,290
but still sometimes with copy paste
17
00:00:54,290 --> 00:00:57,150
or with some other things that happen.
18
00:00:57,150 --> 00:01:00,780
Sometimes we end up deleting these closing tags
19
00:01:00,780 --> 00:01:03,730
and then some error might appear.
20
00:01:03,730 --> 00:01:05,150
So let's say that for some reason,
21
00:01:05,150 --> 00:01:08,580
we never closed the strong element here.
22
00:01:08,580 --> 00:01:12,350
And then our page is going to look like this.
23
00:01:12,350 --> 00:01:14,350
And of course, for this example,
24
00:01:14,350 --> 00:01:18,640
we need to pretend that we don't know about this bug, right?
25
00:01:18,640 --> 00:01:20,503
Anyway, this doesn't make any sense.
26
00:01:21,540 --> 00:01:23,620
So if we just introduced a bug
27
00:01:23,620 --> 00:01:25,950
and then we render our page,
28
00:01:25,950 --> 00:01:30,510
then all of a sudden, our page looks like this, right?
29
00:01:30,510 --> 00:01:33,000
And this might be a little bit scary
30
00:01:33,000 --> 00:01:36,370
because you look at your page and it looks very wrong.
31
00:01:36,370 --> 00:01:40,060
This is not what you intended, right?
32
00:01:40,060 --> 00:01:42,170
So how to fix this?
33
00:01:42,170 --> 00:01:45,460
Well, in this case, it is actually very simple.
34
00:01:45,460 --> 00:01:49,810
All you need to do is to take a look at this result here.
35
00:01:49,810 --> 00:01:51,180
So at this page,
36
00:01:51,180 --> 00:01:54,590
and actually figure out where the bug started.
37
00:01:54,590 --> 00:01:58,240
So the problem here is clearly that all the text is bold,
38
00:01:58,240 --> 00:02:00,490
where you don't want it to be.
39
00:02:00,490 --> 00:02:02,420
And so to debug this code,
40
00:02:02,420 --> 00:02:05,563
you need to look where the code is not bold.
41
00:02:06,420 --> 00:02:09,620
So up here, for example, the text is not bold.
42
00:02:09,620 --> 00:02:12,953
And so the bug must appear somewhere below this.
43
00:02:14,180 --> 00:02:15,740
Then this one here is bold,
44
00:02:15,740 --> 00:02:18,223
but that's simply because it's an h2.
45
00:02:19,318 --> 00:02:23,500
Then here you see some more text that is also not bold.
46
00:02:23,500 --> 00:02:27,480
And then from here on all of a sudden, everything is bold.
47
00:02:27,480 --> 00:02:31,410
And so that means that your bug must be somewhere here.
48
00:02:31,410 --> 00:02:35,460
And so then you can move back to your HTML
49
00:02:35,460 --> 00:02:40,223
and notice that, oh, you did not close this element.
50
00:02:41,070 --> 00:02:42,530
And then it's very simple.
51
00:02:42,530 --> 00:02:45,720
You just come here, close your element,
52
00:02:45,720 --> 00:02:48,593
give it a save and you're back.
53
00:02:51,110 --> 00:02:52,890
And the same can of course happen
54
00:02:52,890 --> 00:02:55,073
on all other kinds of elements.
55
00:02:56,400 --> 00:02:58,980
So let's say for some reason you overrode
56
00:02:58,980 --> 00:03:00,173
this closing tag here.
57
00:03:01,020 --> 00:03:03,090
Then you'll take a look, and again,
58
00:03:03,090 --> 00:03:07,740
everything is suddenly bold and also bigger and blue.
59
00:03:07,740 --> 00:03:10,970
And so maybe immediately from the color and the bold text,
60
00:03:10,970 --> 00:03:15,200
you can see that this now looks like a the h3.
61
00:03:15,200 --> 00:03:17,650
So again, you can then come to your code,
62
00:03:17,650 --> 00:03:21,233
notice that there is a bug and fix it.
63
00:03:22,350 --> 00:03:25,630
Now, one of the bugs that is quite common
64
00:03:25,630 --> 00:03:29,473
is that for example, here, you close the Li
65
00:03:30,490 --> 00:03:33,180
and the leave the content outside.
66
00:03:33,180 --> 00:03:34,743
So something like this.
67
00:03:35,950 --> 00:03:37,810
And then as you check your page,
68
00:03:37,810 --> 00:03:41,010
something looks very off, right?
69
00:03:41,010 --> 00:03:43,820
But then again, it is just a matter of going
70
00:03:43,820 --> 00:03:48,820
to the place in the HTML that corresponds to this problem,
71
00:03:48,940 --> 00:03:51,410
and then figure out what happened.
72
00:03:51,410 --> 00:03:53,430
So this case, that's pretty clear
73
00:03:53,430 --> 00:03:55,663
you have an extra closing Li.
74
00:03:58,030 --> 00:04:03,030
So just close that and we are back to safety here.
75
00:04:04,620 --> 00:04:08,090
Now, what if this happens in like a bigger element?
76
00:04:08,090 --> 00:04:11,273
So let's say here in the aside.
77
00:04:12,220 --> 00:04:15,370
If we delete this, then the error
78
00:04:15,370 --> 00:04:17,193
might not be that apparent.
79
00:04:18,860 --> 00:04:21,990
So you see, it's not that apparent.
80
00:04:21,990 --> 00:04:24,740
All that happened is that this text here
81
00:04:24,740 --> 00:04:28,740
is suddenly inside of this aside element.
82
00:04:28,740 --> 00:04:32,810
So now imagine that you created this bug in your code
83
00:04:32,810 --> 00:04:35,320
very early on, even before you actually
84
00:04:35,320 --> 00:04:37,830
started writing the CSS.
85
00:04:37,830 --> 00:04:39,930
And so in that case, you never noticed
86
00:04:39,930 --> 00:04:41,720
that this was happening.
87
00:04:41,720 --> 00:04:44,710
And then as you started writing the CSS,
88
00:04:44,710 --> 00:04:47,210
you suddenly noticed that this is off,
89
00:04:47,210 --> 00:04:50,013
but you don't really remember writing the HTML.
90
00:04:50,930 --> 00:04:53,940
So you're not sure what might be wrong here.
91
00:04:53,940 --> 00:04:56,690
And so a great solution in that case
92
00:04:56,690 --> 00:05:00,860
is to actually use an HTML validator tool.
93
00:05:00,860 --> 00:05:03,760
So that will basically allow you to see
94
00:05:03,760 --> 00:05:06,443
if your HTML is valid or not.
95
00:05:07,300 --> 00:05:10,810
So to do that, let's copy all the code here.
96
00:05:10,810 --> 00:05:14,363
At least that I think is the easiest way of doing this.
97
00:05:15,400 --> 00:05:20,400
Then here we need to Google, HTML validator
98
00:05:20,870 --> 00:05:24,030
and then usually it should be this very first result,
99
00:05:24,030 --> 00:05:27,370
but I will also have a link to this HTML validator
100
00:05:27,370 --> 00:05:31,003
on my resources page as I showed you before.
101
00:05:32,240 --> 00:05:35,477
So here we can validate by introducing a URI.
102
00:05:36,510 --> 00:05:38,570
So that's something like a URL.
103
00:05:38,570 --> 00:05:40,880
We can manually upload a file,
104
00:05:40,880 --> 00:05:44,570
or we can simply paste the code that we just copied here.
105
00:05:44,570 --> 00:05:47,323
And so again, that is, I think the easiest solution.
106
00:05:48,210 --> 00:05:50,230
So let's click on check
107
00:05:51,820 --> 00:05:54,403
and now actually we have a couple of errors.
108
00:05:55,890 --> 00:06:00,160
So not just the one that we were looking for,
109
00:06:00,160 --> 00:06:02,570
but you'll see that down here actually is
110
00:06:02,570 --> 00:06:05,700
that unclosed element aside.
111
00:06:05,700 --> 00:06:09,960
So that is the bug that we just on purpose introduced.
112
00:06:09,960 --> 00:06:12,253
So let's fix that here.
113
00:06:14,260 --> 00:06:15,710
Now, all right.
114
00:06:15,710 --> 00:06:19,950
Then here we have another error which is end tag div seen,
115
00:06:19,950 --> 00:06:21,880
but they were open elements.
116
00:06:21,880 --> 00:06:24,910
So this error is actually related to this one,
117
00:06:24,910 --> 00:06:28,030
and this is quite common to see in a validator.
118
00:06:28,030 --> 00:06:30,380
So that one error in the code
119
00:06:30,380 --> 00:06:35,380
actually then create some multiple right here, okay?
120
00:06:35,620 --> 00:06:38,783
So these two were fixed by what we just did here,
121
00:06:40,950 --> 00:06:44,530
but then here, apparently we have some other errors
122
00:06:44,530 --> 00:06:45,950
in our code.
123
00:06:45,950 --> 00:06:48,070
So let's actually fixed those.
124
00:06:48,070 --> 00:06:53,070
So in line 131, we have the duplicate attribute width.
125
00:06:54,580 --> 00:06:57,490
So let's fix that.
126
00:06:57,490 --> 00:06:59,760
And actually that's true.
127
00:06:59,760 --> 00:07:02,430
So we have width, and then width again,
128
00:07:02,430 --> 00:07:04,263
and of course this should be height.
129
00:07:06,240 --> 00:07:08,680
So height, like this.
130
00:07:08,680 --> 00:07:11,850
And then finally there is yet another one.
131
00:07:11,850 --> 00:07:16,850
So in line 137, attribute height not allowed.
132
00:07:17,240 --> 00:07:22,240
And actually the problem here is that this is misspelled.
133
00:07:22,740 --> 00:07:24,313
So that's a stupid error.
134
00:07:25,310 --> 00:07:30,103
So it's not th but ht like this.
135
00:07:31,730 --> 00:07:35,030
So you see that actually, even before on purpose,
136
00:07:35,030 --> 00:07:39,900
introducing a bug, we had invalid HTML all along.
137
00:07:39,900 --> 00:07:41,963
So now I'm copying it again.
138
00:07:44,420 --> 00:07:47,780
So then here I will command or control a
139
00:07:47,780 --> 00:07:51,853
to select everything, delete it and paste it again.
140
00:07:53,770 --> 00:07:58,423
Then check and now we have no errors or warnings to show.
141
00:07:59,270 --> 00:08:03,720
Okay, so that is the HTML validator.
142
00:08:03,720 --> 00:08:06,250
So, a very useful tool,
143
00:08:06,250 --> 00:08:09,100
but let me now actually show you another tool,
144
00:08:09,100 --> 00:08:12,200
which is a div checker and a div checker
145
00:08:12,200 --> 00:08:15,380
can be very helpful to compare your own code
146
00:08:15,380 --> 00:08:20,000
with my code that I actually code here in the videos.
147
00:08:20,000 --> 00:08:22,070
So in case you run into any problem
148
00:08:22,070 --> 00:08:25,200
where your page looks different than mine,
149
00:08:25,200 --> 00:08:27,620
probably something is wrong in your code.
150
00:08:27,620 --> 00:08:29,470
And so in that situation,
151
00:08:29,470 --> 00:08:33,893
you can compare your code automatically to mine, basically.
152
00:08:35,500 --> 00:08:37,450
So let's say that for some reason,
153
00:08:37,450 --> 00:08:41,733
instead of using the a element here, you use link.
154
00:08:43,350 --> 00:08:45,723
And link doesn't make any sense here,
155
00:08:46,770 --> 00:08:51,690
but well, with anchors, we are actually creating hyperlinks.
156
00:08:51,690 --> 00:08:55,150
And so for some reason, you might have made a mistake
157
00:08:55,150 --> 00:08:57,930
of, instead of using a, using link,
158
00:08:57,930 --> 00:08:59,050
because you might've thought
159
00:08:59,050 --> 00:09:00,943
that this is what creates links.
160
00:09:01,970 --> 00:09:06,730
And so now somehow your code here is not clickable
161
00:09:06,730 --> 00:09:09,293
and it's black instead of blue.
162
00:09:10,950 --> 00:09:14,800
And actually let's go back to our CSS here
163
00:09:14,800 --> 00:09:18,100
and in the nav remove this piece of code
164
00:09:18,100 --> 00:09:21,133
that we added in the last video, right?
165
00:09:22,220 --> 00:09:25,620
But anyway, now let's actually compare this code
166
00:09:25,620 --> 00:09:27,150
with my code.
167
00:09:27,150 --> 00:09:29,603
So with the final code in this section.
168
00:09:30,750 --> 00:09:35,553
So let's search for div checker like this,
169
00:09:37,570 --> 00:09:40,653
and then you can simply use divchecker.com.
170
00:09:41,710 --> 00:09:44,750
So here you will put your code.
171
00:09:44,750 --> 00:09:49,750
So again, command or control a, then copy, then paste.
172
00:09:50,980 --> 00:09:52,499
And now here on this side,
173
00:09:52,499 --> 00:09:57,020
you need the other code or actually the other way around.
174
00:09:57,020 --> 00:09:59,540
So here you want the original.
175
00:09:59,540 --> 00:10:04,420
So let's delete that and here your changed text.
176
00:10:04,420 --> 00:10:09,290
And so let's now come to the code that you downloaded.
177
00:10:09,290 --> 00:10:13,990
So this repository, and then I have the final folder here.
178
00:10:13,990 --> 00:10:16,970
And so this is what you can use this code for.
179
00:10:16,970 --> 00:10:19,293
So to compare it with your own code.
180
00:10:20,340 --> 00:10:24,230
So we are in this section of the CSS fundamentals
181
00:10:24,230 --> 00:10:26,570
and we're interested in the index.
182
00:10:26,570 --> 00:10:28,480
And so in order to open this up,
183
00:10:28,480 --> 00:10:32,960
we can very simply drag it onto the VS Code icon
184
00:10:32,960 --> 00:10:36,120
here in the menu bar.
185
00:10:36,120 --> 00:10:39,453
And so this is, basically the final code of this section.
186
00:10:40,300 --> 00:10:43,883
So, so again, selecting everything, copying it,
187
00:10:44,800 --> 00:10:46,960
then I can paste that here.
188
00:10:46,960 --> 00:10:49,710
And then somewhere there should be
189
00:10:49,710 --> 00:10:51,273
the find different button.
190
00:10:52,300 --> 00:10:54,600
So by the time you are watching this video,
191
00:10:54,600 --> 00:10:57,410
this interface might look a little bit different,
192
00:10:57,410 --> 00:11:00,490
but the basic idea should still be there.
193
00:11:00,490 --> 00:11:02,580
That you have two text boxes
194
00:11:02,580 --> 00:11:04,463
and then some button to compare them.
195
00:11:05,810 --> 00:11:09,860
So just click that and then you see the differences
196
00:11:09,860 --> 00:11:12,270
nicely marked in here.
197
00:11:12,270 --> 00:11:15,550
So in the original, of course we have the a element
198
00:11:15,550 --> 00:11:20,550
while you, for some reason had the link, okay?
199
00:11:20,610 --> 00:11:22,760
And in this case that's the only difference
200
00:11:24,410 --> 00:11:26,920
or actually here is some other one.
201
00:11:26,920 --> 00:11:29,573
So the closing tag and here is just closing.
202
00:11:30,910 --> 00:11:35,910
So let me actually fix that as well.
203
00:11:36,220 --> 00:11:38,600
So here, of course it should be a,
204
00:11:38,600 --> 00:11:40,280
let's put that back
205
00:11:41,480 --> 00:11:44,303
and in here there's also something wrong in content.
206
00:11:45,600 --> 00:11:49,993
So closing tag here, it should be the closing tag.
207
00:11:50,940 --> 00:11:53,330
Let's see if there is something else,
208
00:11:53,330 --> 00:11:58,330
but ah, yeah, here are these bugs that we just solved also.
209
00:12:00,510 --> 00:12:04,910
So previously we had width twice, right?
210
00:12:04,910 --> 00:12:06,350
And so we fixed that already.
211
00:12:06,350 --> 00:12:07,770
And so here we are good.
212
00:12:07,770 --> 00:12:09,790
And this was wrong previously.
213
00:12:09,790 --> 00:12:13,793
So in the final file, it was actually still wrong, okay?
214
00:12:14,780 --> 00:12:17,013
But besides that, that's it.
215
00:12:18,110 --> 00:12:18,990
Okay.
216
00:12:18,990 --> 00:12:21,230
Then down here, we have access again to
217
00:12:21,230 --> 00:12:24,990
that text so we can do some changes here.
218
00:12:24,990 --> 00:12:26,890
So let me just introduce a couple more,
219
00:12:26,890 --> 00:12:29,293
just so we could see how that looks like then.
220
00:12:31,200 --> 00:12:35,783
So this Li here, let's say we didn't close this somehow.
221
00:12:36,950 --> 00:12:40,640
Let's say that here inside of the footer,
222
00:12:40,640 --> 00:12:44,293
we actually closed not footer, but header for some reason.
223
00:12:46,840 --> 00:12:49,263
Okay, find a difference.
224
00:12:50,320 --> 00:12:55,320
And then here you see that it looks very different.
225
00:12:56,640 --> 00:12:58,780
So even if you have just empty lines,
226
00:12:58,780 --> 00:13:02,353
it will still show up here in the div checker.
227
00:13:04,440 --> 00:13:05,273
Right?
228
00:13:05,273 --> 00:13:07,833
So that's all the changes that we just introduced.
229
00:13:08,720 --> 00:13:10,950
Now, okay, great.
230
00:13:10,950 --> 00:13:14,090
So div checker and HTML validators
231
00:13:14,090 --> 00:13:19,090
are two extremely helpful tools to debug your HTML code.
232
00:13:20,020 --> 00:13:23,890
But now let's go actually to CSS because there are also
233
00:13:23,890 --> 00:13:27,490
some potential bugs that might happen there.
234
00:13:27,490 --> 00:13:31,410
Now, one of the most common sources of bugs in CSS
235
00:13:31,410 --> 00:13:33,913
are some conflicts between selectors.
236
00:13:34,820 --> 00:13:39,720
So let's select these links here once again,
237
00:13:39,720 --> 00:13:42,460
and keep in mind that they are inside of the nav,
238
00:13:42,460 --> 00:13:44,853
which is inside of the main header.
239
00:13:46,360 --> 00:13:47,193
Okay.
240
00:13:48,550 --> 00:13:53,550
So we have the nav a link here, but for some reason,
241
00:13:53,770 --> 00:13:56,660
let's imagine that we selected these links also
242
00:13:56,660 --> 00:14:01,500
somewhere else and then edit some different style there.
243
00:14:01,500 --> 00:14:04,210
So let's say somewhere here in the middle
244
00:14:04,210 --> 00:14:05,610
of the rest of the code,
245
00:14:05,610 --> 00:14:08,750
and here we wrote a different selector.
246
00:14:08,750 --> 00:14:13,068
So let's say that here we wrote main header
247
00:14:13,068 --> 00:14:17,750
and then inside of that the nav and then inside that the a
248
00:14:19,460 --> 00:14:23,913
like this, and here we set the color actually to red.
249
00:14:25,580 --> 00:14:28,800
Okay, but we still want our color to be blue.
250
00:14:28,800 --> 00:14:33,083
But now if we reload this, then our text is actually red.
251
00:14:34,000 --> 00:14:35,650
So we have two selectors,
252
00:14:35,650 --> 00:14:38,923
which both define the color and they both apply.
253
00:14:40,600 --> 00:14:45,600
And so if before you wrote this and only later you
254
00:14:45,610 --> 00:14:47,340
then wrote this piece of code
255
00:14:47,340 --> 00:14:49,940
and wanted the texts actually to be blue,
256
00:14:49,940 --> 00:14:51,500
then you might not be understanding
257
00:14:51,500 --> 00:14:53,193
what actually happens here.
258
00:14:54,070 --> 00:14:58,840
While the color is actually not the perfect example here.
259
00:14:58,840 --> 00:15:02,023
So let's play instead with the margin top.
260
00:15:04,500 --> 00:15:05,780
So let's say that for some reason,
261
00:15:05,780 --> 00:15:10,780
you defined the margin top to be 100 pixels for the link,
262
00:15:11,000 --> 00:15:13,160
but then a bit later, again,
263
00:15:13,160 --> 00:15:16,700
you write this rule here where you actually only want
264
00:15:16,700 --> 00:15:18,633
the margin top to be 10 pixels.
265
00:15:19,470 --> 00:15:22,850
So you are writing this rule, then you give it a save.
266
00:15:22,850 --> 00:15:25,960
And all of a sudden it looks like this.
267
00:15:25,960 --> 00:15:27,673
So you have 100 pixels.
268
00:15:28,510 --> 00:15:30,730
So what is happening?
269
00:15:30,730 --> 00:15:35,400
Well, let's inspect and well,
270
00:15:37,610 --> 00:15:41,090
you see that both of these selectors apply of course.
271
00:15:41,090 --> 00:15:42,770
So both of the rules.
272
00:15:42,770 --> 00:15:45,720
But the margin top that does actually apply
273
00:15:45,720 --> 00:15:49,160
is this one here in this longer selector.
274
00:15:49,160 --> 00:15:50,920
So as a rule of thumb,
275
00:15:50,920 --> 00:15:53,650
besides the rules that we already learned before
276
00:15:53,650 --> 00:15:55,810
about selector priority,
277
00:15:55,810 --> 00:15:59,390
if one selector is way more complex than the other,
278
00:15:59,390 --> 00:16:02,340
then many times it's actually the more complex one
279
00:16:02,340 --> 00:16:04,010
that gets applied.
280
00:16:04,010 --> 00:16:05,030
Okay.
281
00:16:05,030 --> 00:16:07,440
And so that's why I also told you before
282
00:16:07,440 --> 00:16:10,760
that you should avoid writing a selector like this.
283
00:16:10,760 --> 00:16:12,740
So a very complex one.
284
00:16:12,740 --> 00:16:15,610
So keep your selector simple, like this one,
285
00:16:15,610 --> 00:16:19,123
and that will then avoid creating bugs like this.
286
00:16:20,070 --> 00:16:21,620
Okay.
287
00:16:21,620 --> 00:16:23,430
Now, technically here,
288
00:16:23,430 --> 00:16:26,620
if we take a look at the selector specificity,
289
00:16:26,620 --> 00:16:30,000
you see it, that it has 1,2 right?
290
00:16:30,000 --> 00:16:33,240
So memorize that 0, 1, 2.
291
00:16:33,240 --> 00:16:35,690
And here we have 0, 2, 2.
292
00:16:35,690 --> 00:16:37,770
And so these numbers are larger
293
00:16:37,770 --> 00:16:41,530
and therefore this is the one that actually gets applied.
294
00:16:41,530 --> 00:16:43,100
Now I mentioned before,
295
00:16:43,100 --> 00:16:45,230
not to worry about specificity
296
00:16:45,230 --> 00:16:47,210
because that gets too complex,
297
00:16:47,210 --> 00:16:49,580
but basically the higher the numbers,
298
00:16:49,580 --> 00:16:52,427
the more that selector apply.
299
00:16:52,427 --> 00:16:53,800
All right?
300
00:16:53,800 --> 00:16:57,660
So don't write selectors like this
301
00:16:57,660 --> 00:17:01,210
and instead keep their specificity low.
302
00:17:01,210 --> 00:17:02,300
Okay.
303
00:17:02,300 --> 00:17:04,430
And if you follow the rules that I showed you
304
00:17:04,430 --> 00:17:09,140
about the priority of selectors, then you should be fine.
305
00:17:09,140 --> 00:17:11,600
Another common problem that might happen
306
00:17:11,600 --> 00:17:15,430
is that for some reason you misspelled a property name
307
00:17:15,430 --> 00:17:17,320
and that happens all the time.
308
00:17:17,320 --> 00:17:22,320
So let's say that instead of right, you wrote this,
309
00:17:22,514 --> 00:17:23,520
then you give it a save.
310
00:17:23,520 --> 00:17:26,510
And of course the element is not positioned
311
00:17:26,510 --> 00:17:28,700
where you expected it to be.
312
00:17:28,700 --> 00:17:30,110
So in that case,
313
00:17:30,110 --> 00:17:33,510
the simple thing to do is simply to inspect that element
314
00:17:34,350 --> 00:17:37,550
and then check out what happened there.
315
00:17:37,550 --> 00:17:40,810
Now in the case of a pseudo element like this,
316
00:17:40,810 --> 00:17:43,090
you will actually have to then click here
317
00:17:43,090 --> 00:17:44,800
to open the element itself,
318
00:17:44,800 --> 00:17:48,330
and then from there you can select the pseudo element.
319
00:17:48,330 --> 00:17:51,320
And then you can simply check out the properties here
320
00:17:51,320 --> 00:17:53,560
and you will then find this icon here,
321
00:17:53,560 --> 00:17:56,220
which means unknown property name.
322
00:17:56,220 --> 00:17:58,660
And so from that, you will immediately know
323
00:17:58,660 --> 00:18:02,800
that here you misspelled something.
324
00:18:02,800 --> 00:18:06,910
So then you come here to your code, fix that
325
00:18:06,910 --> 00:18:09,310
and you're a good to go again.
326
00:18:09,310 --> 00:18:12,240
So this one is also more common than you thought.
327
00:18:12,240 --> 00:18:14,530
And so doing what I just did here
328
00:18:14,530 --> 00:18:16,280
is always a good idea.
329
00:18:16,280 --> 00:18:20,050
And in general, it is also always a good idea
330
00:18:20,050 --> 00:18:23,400
to always experiment with this code
331
00:18:23,400 --> 00:18:25,720
that you have here in the dev tools
332
00:18:25,720 --> 00:18:27,030
and play around with it.
333
00:18:27,030 --> 00:18:29,920
And for example, tweak values here.
334
00:18:29,920 --> 00:18:32,500
So instead of, for example,
335
00:18:32,500 --> 00:18:36,120
experimenting with the h2 font size here in the code,
336
00:18:36,120 --> 00:18:40,130
you can simply come here to this value, click it,
337
00:18:40,130 --> 00:18:44,020
and then on your keyboard, you can use the up and down keys,
338
00:18:44,020 --> 00:18:45,393
just like it says here.
339
00:18:46,280 --> 00:18:47,780
Actually, so in that tool tip.
340
00:18:49,140 --> 00:18:53,040
So with this, you can see real life how these values changed
341
00:18:53,040 --> 00:18:56,170
and you can also use shift and up and down,
342
00:18:56,170 --> 00:18:59,523
and then it will increment in steps of 10.
343
00:19:01,460 --> 00:19:03,010
So this is very, very helpful.
344
00:19:03,010 --> 00:19:05,720
I do this all the time when I'm experimenting
345
00:19:05,720 --> 00:19:08,720
with different values, okay.
346
00:19:08,720 --> 00:19:11,130
And if for some reason you somehow really
347
00:19:11,130 --> 00:19:12,980
cannot fix your code.
348
00:19:12,980 --> 00:19:15,940
Then of course, again, you can use the div checker
349
00:19:15,940 --> 00:19:18,880
to compare your CSS code with the one
350
00:19:18,880 --> 00:19:20,390
that I show in the video.
351
00:19:20,390 --> 00:19:22,870
So the final code of the section,
352
00:19:22,870 --> 00:19:24,560
that is in the repository
353
00:19:24,560 --> 00:19:26,700
that I just showed you before.
354
00:19:26,700 --> 00:19:29,470
Now, finally, one error that I see beginners make
355
00:19:29,470 --> 00:19:33,450
all the time is to not correctly link the CSS file
356
00:19:33,450 --> 00:19:34,423
in the first place.
357
00:19:35,810 --> 00:19:40,810
So remember that, that happens up here in this link.
358
00:19:41,230 --> 00:19:43,370
And sometimes for some reasons,
359
00:19:43,370 --> 00:19:47,520
students mess up the path to the CSS file.
360
00:19:47,520 --> 00:19:50,970
That's also because sometimes we might want to put this
361
00:19:50,970 --> 00:19:53,060
into a different folder.
362
00:19:53,060 --> 00:19:55,120
So just like we did with the images.
363
00:19:55,120 --> 00:19:58,520
And then you need to correctly, of course, write the path
364
00:19:58,520 --> 00:20:01,610
in relation to this HTML file.
365
00:20:01,610 --> 00:20:05,860
So in case that no CSS at all is applied to your page,
366
00:20:05,860 --> 00:20:07,990
then the first thing that you need to check
367
00:20:07,990 --> 00:20:10,490
is if this link here is correct.
368
00:20:10,490 --> 00:20:14,650
So if your style sheet was correctly linked to your HTML.
369
00:20:14,650 --> 00:20:16,020
Okay?
370
00:20:16,020 --> 00:20:19,930
So this is how you fix some of the most common bugs
371
00:20:19,930 --> 00:20:22,630
in HTML and CSS.
372
00:20:22,630 --> 00:20:26,320
But if for some reason you really, really cannot fix
373
00:20:26,320 --> 00:20:28,390
any of the bugs that you found,
374
00:20:28,390 --> 00:20:31,270
even using all of the tools that I just showed you
375
00:20:31,270 --> 00:20:35,050
in this video, then of course you can ask a question
376
00:20:35,050 --> 00:20:38,040
in one of the platforms that I just showed you.
377
00:20:38,040 --> 00:20:41,280
And in particular on Stack Overflow,
378
00:20:41,280 --> 00:20:44,230
or you can also post a new question here
379
00:20:44,230 --> 00:20:46,350
in the Udemy Q and A.
380
00:20:46,350 --> 00:20:49,090
Now what matters here is that you always post
381
00:20:49,090 --> 00:20:52,280
all of your code to a code pen first.
382
00:20:52,280 --> 00:20:55,920
So instead of a copy and paste all your code
383
00:20:55,920 --> 00:21:00,080
to Stack Overflow or into the Udemy Q and A,
384
00:21:00,080 --> 00:21:03,640
please make it easy for the person who will help you.
385
00:21:03,640 --> 00:21:07,623
And instead paste all your code into a code pen.
386
00:21:08,920 --> 00:21:12,130
So we have already used code pen for the challenges,
387
00:21:12,130 --> 00:21:16,380
but just to make sure, well, where is it now?
388
00:21:19,140 --> 00:21:19,973
Oh, here.
389
00:21:19,973 --> 00:21:21,260
So start coding,
390
00:21:21,260 --> 00:21:24,130
or you can just write slash pen
391
00:21:24,130 --> 00:21:26,790
and then again, grab all your code,
392
00:21:26,790 --> 00:21:30,850
put a tear in the HTML and then all your CSS right here.
393
00:21:30,850 --> 00:21:34,260
And in case you have JavaScript, you can also put it here,
394
00:21:34,260 --> 00:21:37,636
then you'll save it for which you will need an account.
395
00:21:37,636 --> 00:21:41,410
And then you just copy the URL and paste it
396
00:21:41,410 --> 00:21:45,420
either to Stack Overflow or to the Udemy Q and A section.
397
00:21:45,420 --> 00:21:46,253
Okay?
398
00:21:47,680 --> 00:21:48,530
Now, right.
399
00:21:48,530 --> 00:21:52,180
And I think that's it about the basic skills
400
00:21:52,180 --> 00:21:55,320
of debugging and asking questions.
401
00:21:55,320 --> 00:21:59,000
So of course, debugging can go a lot deeper than just this,
402
00:21:59,000 --> 00:22:02,080
but for now, I just wanted to give you an overview
403
00:22:02,080 --> 00:22:05,720
of what debugging is and how it works.
404
00:22:05,720 --> 00:22:08,030
And now to wrap up this section,
405
00:22:08,030 --> 00:22:10,480
let's continue building our coding challenge
406
00:22:10,480 --> 00:22:13,703
that we have been building ,in the next video.
30337
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.