Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,680 --> 00:00:02,750
Welcome back
2
00:00:02,750 --> 00:00:06,830
to the last coding challenge of this section.
3
00:00:06,830 --> 00:00:11,083
And as always, we will keep working on our same project.
4
00:00:12,600 --> 00:00:15,110
So, this is how we left it
5
00:00:15,110 --> 00:00:17,900
after our coding challenge, number two.
6
00:00:17,900 --> 00:00:21,130
And so as always, keep this as a starting point
7
00:00:21,130 --> 00:00:24,030
which hopefully you have on some CodePen
8
00:00:24,030 --> 00:00:25,930
or somewhere on your computer.
9
00:00:25,930 --> 00:00:30,930
And if not, the link to this code will be in this lecture.
10
00:00:31,030 --> 00:00:33,060
And what I want you to do
11
00:00:33,060 --> 00:00:36,523
is basically to change this to this.
12
00:00:37,420 --> 00:00:41,410
And essentially there are only two big changes.
13
00:00:41,410 --> 00:00:44,250
First, we have this sale label here
14
00:00:44,250 --> 00:00:48,090
in this top left corner of the element.
15
00:00:48,090 --> 00:00:50,090
And then also down here,
16
00:00:50,090 --> 00:00:54,080
we have basically these six available colors
17
00:00:54,080 --> 00:00:56,340
in which we can buy the shoe.
18
00:00:56,340 --> 00:01:00,143
So I want you to build this part here and this.
19
00:01:01,280 --> 00:01:03,570
So this sale is very similar
20
00:01:03,570 --> 00:01:05,660
to something that we did before.
21
00:01:05,660 --> 00:01:10,660
So hopefully you remember that's this, okay.
22
00:01:10,780 --> 00:01:13,610
But in this case, you actually don't need to use
23
00:01:13,610 --> 00:01:16,110
a pseudo element for that.
24
00:01:16,110 --> 00:01:19,190
You can simply add a element, for example,
25
00:01:19,190 --> 00:01:23,560
a paragraph for the sale and then position it here,
26
00:01:23,560 --> 00:01:27,520
just like we did it in one of the previous lectures.
27
00:01:27,520 --> 00:01:30,090
Now, maybe you're noticing this detail
28
00:01:30,090 --> 00:01:33,260
that in this text, there is some space
29
00:01:33,260 --> 00:01:35,530
between the different characters
30
00:01:35,530 --> 00:01:38,410
or these letters here, right?
31
00:01:38,410 --> 00:01:42,330
And so there is a CSS property which allows you to do that.
32
00:01:42,330 --> 00:01:45,530
And what I want you to do is to Google that.
33
00:01:45,530 --> 00:01:48,170
So I want you to use Google to figure out
34
00:01:48,170 --> 00:01:51,810
how you can add that space a little bit like I showed you
35
00:01:51,810 --> 00:01:56,360
in the developer skills lecture about Googling.
36
00:01:56,360 --> 00:01:59,240
So now you can apply that as well.
37
00:01:59,240 --> 00:02:00,770
Okay?
38
00:02:00,770 --> 00:02:03,402
So that is one of the things that you need to do.
39
00:02:03,402 --> 00:02:06,250
And the other one is this here.
40
00:02:06,250 --> 00:02:07,830
So basically what you will need
41
00:02:07,830 --> 00:02:10,660
to do is to create an element.
42
00:02:10,660 --> 00:02:14,523
And then inside of that element, which can be a simple div.
43
00:02:15,380 --> 00:02:17,150
So inside of that element,
44
00:02:17,150 --> 00:02:20,280
then you need to create six more elements.
45
00:02:20,280 --> 00:02:23,260
And these can also be divs if you like.
46
00:02:23,260 --> 00:02:25,970
And then all you need to do is to give each of them
47
00:02:25,970 --> 00:02:28,920
a color and put them side by side,
48
00:02:28,920 --> 00:02:31,110
using a neat little trick
49
00:02:31,110 --> 00:02:35,050
that we actually also learned in one of the lectures.
50
00:02:35,050 --> 00:02:37,400
And in particular, it was the lecture
51
00:02:37,400 --> 00:02:42,030
about the types of boxes, if I remember correctly.
52
00:02:42,030 --> 00:02:46,140
So this was a nice little trick that we used there.
53
00:02:46,140 --> 00:02:48,670
And so you can use that here as well.
54
00:02:48,670 --> 00:02:50,610
And if you don't remember it,
55
00:02:50,610 --> 00:02:53,640
as always there is absolutely no problem
56
00:02:53,640 --> 00:02:56,060
if you need to go back to our code
57
00:02:56,060 --> 00:02:58,880
and look up exactly how we did that.
58
00:02:58,880 --> 00:03:02,130
And the same, of course, goes for this technique here.
59
00:03:02,130 --> 00:03:04,300
So I don't expect that you memorize
60
00:03:04,300 --> 00:03:06,470
all the techniques that I show you here.
61
00:03:06,470 --> 00:03:09,050
But if you can look them up in your code
62
00:03:09,050 --> 00:03:11,780
and translate them to a different situation,
63
00:03:11,780 --> 00:03:15,210
that already would be an amazing achievement.
64
00:03:15,210 --> 00:03:16,220
Okay.
65
00:03:16,220 --> 00:03:18,030
So if you can just do that,
66
00:03:18,030 --> 00:03:21,310
then please go ahead and pause the video now
67
00:03:21,310 --> 00:03:23,763
and I'll see you once you're done.
68
00:03:26,950 --> 00:03:29,750
All right back to work here.
69
00:03:29,750 --> 00:03:33,630
And let's start with the sale label.
70
00:03:33,630 --> 00:03:37,520
So as I said, I will simply add a paragraph somewhere.
71
00:03:37,520 --> 00:03:40,850
And since we will position it, absolutely,
72
00:03:40,850 --> 00:03:43,330
it doesn't really matter where it is.
73
00:03:43,330 --> 00:03:45,060
But I will just put it here
74
00:03:45,060 --> 00:03:47,300
close to the price and the shipping
75
00:03:47,300 --> 00:03:49,810
because semantically that's where
76
00:03:49,810 --> 00:03:51,753
it makes sense to be located.
77
00:03:54,930 --> 00:03:58,203
So let's give it a class of sale.
78
00:04:01,040 --> 00:04:04,690
And then we want the text of sale as well.
79
00:04:04,690 --> 00:04:07,123
And then let's close this.
80
00:04:08,870 --> 00:04:11,820
And now we're here in our CSS.
81
00:04:11,820 --> 00:04:16,820
Let's put it also close to this shipping.
82
00:04:16,970 --> 00:04:17,823
So down here.
83
00:04:19,870 --> 00:04:22,943
And let's start by adding some visual styles to it.
84
00:04:25,670 --> 00:04:28,880
So some background color, for example.
85
00:04:28,880 --> 00:04:30,670
And here you could have just used
86
00:04:30,670 --> 00:04:32,440
any red color that you wanted.
87
00:04:32,440 --> 00:04:35,570
For example, using the VS Code Color Picker.
88
00:04:35,570 --> 00:04:37,520
And I also did that.
89
00:04:37,520 --> 00:04:40,207
And so the color I came up with is ec2f2f.
90
00:04:44,410 --> 00:04:45,423
Just like this.
91
00:04:46,343 --> 00:04:47,393
It actually go there.
92
00:04:48,240 --> 00:04:49,133
Now, right.
93
00:04:50,370 --> 00:04:53,010
Then let's worry about the text.
94
00:04:53,010 --> 00:04:55,033
So let's make it white.
95
00:04:56,090 --> 00:04:57,053
Like this.
96
00:04:58,810 --> 00:05:03,733
Give it a font size of 12 pixels and make it uppercase.
97
00:05:09,260 --> 00:05:11,393
And make it bold as well.
98
00:05:13,910 --> 00:05:16,963
So font weight, bold.
99
00:05:19,400 --> 00:05:21,060
Let's give it some padding.
100
00:05:21,060 --> 00:05:24,143
7 pixels at the top, 15 left and right.
101
00:05:25,150 --> 00:05:27,510
And again, these don't really matter.
102
00:05:27,510 --> 00:05:29,510
But many times it's a good idea
103
00:05:29,510 --> 00:05:31,860
to have the horizontal padding
104
00:05:31,860 --> 00:05:34,103
to be kind of double of vertical.
105
00:05:35,060 --> 00:05:36,580
That's a good rule of thumb
106
00:05:36,580 --> 00:05:38,653
that many times looks very good.
107
00:05:39,520 --> 00:05:44,300
And now the next step is that, actually we want this element
108
00:05:44,300 --> 00:05:47,463
only to occupy the space that it actually needs.
109
00:05:48,480 --> 00:05:51,850
So, there are two techniques for that.
110
00:05:51,850 --> 00:05:54,770
Well, actually just one, but you could also kind
111
00:05:54,770 --> 00:05:57,460
of achieve this in a different way.
112
00:05:57,460 --> 00:05:59,550
So the best way to do this
113
00:06:01,190 --> 00:06:04,403
would be to set a display to inline box,
114
00:06:06,510 --> 00:06:08,620
actually inline block.
115
00:06:08,620 --> 00:06:12,193
And so now indeed, just like any inline element,
116
00:06:13,290 --> 00:06:17,440
the box only occupies the space of its content.
117
00:06:17,440 --> 00:06:18,273
Okay.
118
00:06:18,273 --> 00:06:20,030
So this is the correct solution,
119
00:06:20,030 --> 00:06:23,840
but let's comment this out to show you another solution.
120
00:06:23,840 --> 00:06:26,060
So you could have also kind of guessed
121
00:06:26,060 --> 00:06:29,630
the with of this element, if you wanted.
122
00:06:29,630 --> 00:06:33,853
Let's say 100 pixels and then we could adjust it.
123
00:06:34,930 --> 00:06:39,930
So let's say just 80 pixels or just 50 pixels maybe.
124
00:06:40,250 --> 00:06:42,740
Or 40 even.
125
00:06:42,740 --> 00:06:45,780
And then once you kind of got close,
126
00:06:45,780 --> 00:06:49,830
you can then just say text, align, center.
127
00:06:51,900 --> 00:06:54,370
Because now there is actually enough space
128
00:06:54,370 --> 00:06:56,070
around the element inside
129
00:06:56,070 --> 00:06:58,263
of which the text could then be centered.
130
00:06:59,290 --> 00:07:00,170
Okay.
131
00:07:00,170 --> 00:07:02,350
So when we have actually a width,
132
00:07:02,350 --> 00:07:04,630
then we are no longer in that situation
133
00:07:04,630 --> 00:07:08,980
where text align center doesn't make sense in an element.
134
00:07:08,980 --> 00:07:12,120
Like we had before here with these links.
135
00:07:12,120 --> 00:07:14,993
Remember that? So I think like two lectures ago.
136
00:07:16,350 --> 00:07:19,670
But anyway, this is not the preferred solution,
137
00:07:19,670 --> 00:07:23,300
but it is something that we could also have done.
138
00:07:23,300 --> 00:07:27,370
So, I found that interesting to also show you that.
139
00:07:27,370 --> 00:07:29,230
And so now it's time to actually
140
00:07:29,230 --> 00:07:33,620
absolutely position this element right here.
141
00:07:33,620 --> 00:07:37,380
So let's remember that the first thing that we need to do
142
00:07:37,380 --> 00:07:40,520
in order to absolutely position an element
143
00:07:40,520 --> 00:07:44,330
is to define in relation to what parent element,
144
00:07:44,330 --> 00:07:46,660
this element should be positioned.
145
00:07:46,660 --> 00:07:50,703
And so on that parent element, we set position to relative.
146
00:07:51,600 --> 00:07:54,633
So in this case, that should be quite easy, right?
147
00:07:54,633 --> 00:07:58,470
That is simply this product here.
148
00:07:58,470 --> 00:08:01,880
So this article with the class of product.
149
00:08:01,880 --> 00:08:03,220
And so, this is where now we want
150
00:08:03,220 --> 00:08:08,013
to set position to relative.
151
00:08:09,590 --> 00:08:12,380
And so, now we can go back here
152
00:08:13,830 --> 00:08:17,603
and say position absolute.
153
00:08:18,820 --> 00:08:22,473
And set the top and left to zero. Just to get started.
154
00:08:25,150 --> 00:08:26,820
Okay.
155
00:08:26,820 --> 00:08:31,130
And now we can kind of guess the values
156
00:08:31,130 --> 00:08:32,420
where this should be.
157
00:08:32,420 --> 00:08:36,520
So, let's say like minus 15 pixels.
158
00:08:36,520 --> 00:08:39,823
That can be a little bit more, 17.
159
00:08:41,150 --> 00:08:41,983
Yeah.
160
00:08:41,983 --> 00:08:44,820
So now it's like nicely in the middle
161
00:08:44,820 --> 00:08:48,963
and now let's move it also like 30 pixels to the left.
162
00:08:49,900 --> 00:08:52,430
So that's not quite centered yet.
163
00:08:52,430 --> 00:08:54,323
Let's say 35.
164
00:08:55,430 --> 00:08:57,150
Well, let's actually make it 34,
165
00:08:57,150 --> 00:08:59,893
so it's exactly double off the top.
166
00:09:00,910 --> 00:09:05,400
All right. So with this, we are almost done with this part.
167
00:09:05,400 --> 00:09:08,480
All that's missing is this extra space
168
00:09:08,480 --> 00:09:10,300
between the characters.
169
00:09:10,300 --> 00:09:11,170
Right?
170
00:09:11,170 --> 00:09:13,390
So to give it this extra touch,
171
00:09:13,390 --> 00:09:16,000
and also because I wanted you
172
00:09:16,000 --> 00:09:18,840
to practice your Googling skills.
173
00:09:18,840 --> 00:09:21,040
So what I would have Googled is,
174
00:09:21,040 --> 00:09:26,040
CSS add space between characters,
175
00:09:26,810 --> 00:09:29,023
or you could have written letters as well,
176
00:09:30,220 --> 00:09:34,450
but here you actually immediately get the result.
177
00:09:34,450 --> 00:09:36,330
So letters spacing.
178
00:09:36,330 --> 00:09:38,290
But I'm more interested in here,
179
00:09:38,290 --> 00:09:40,680
usually in a stack overflow reply
180
00:09:40,680 --> 00:09:44,270
or this documentation of MDN.
181
00:09:44,270 --> 00:09:45,770
So here we have letter spacing,
182
00:09:45,770 --> 00:09:48,890
which looks like something we want.
183
00:09:48,890 --> 00:09:51,530
And so here, indeed we get as always
184
00:09:51,530 --> 00:09:53,950
a couple of different examples.
185
00:09:53,950 --> 00:09:58,040
And so, yeah. This is the property that we're gonna use.
186
00:09:58,040 --> 00:09:59,343
So I'm copying it.
187
00:10:00,570 --> 00:10:03,800
Let's put it here, close to these styles.
188
00:10:03,800 --> 00:10:06,313
And I'm setting it to two pixels.
189
00:10:07,810 --> 00:10:11,770
And yeah. That actually looks a lot nicer.
190
00:10:11,770 --> 00:10:14,600
Now we just need to like, push it
191
00:10:14,600 --> 00:10:19,600
even a bit more to the side there, like this.
192
00:10:19,840 --> 00:10:23,770
To center it. And yeah, that's it.
193
00:10:23,770 --> 00:10:25,940
So we are done with this part.
194
00:10:25,940 --> 00:10:29,120
So now let's quickly add those colors here.
195
00:10:29,120 --> 00:10:33,660
And as I said, previously, we will basically create a div.
196
00:10:33,660 --> 00:10:36,860
So a container without any semantic meaning.
197
00:10:36,860 --> 00:10:39,990
And then in there, I will create six more divs.
198
00:10:39,990 --> 00:10:43,313
And then each of them will get its own background color.
199
00:10:45,520 --> 00:10:50,520
So, that should be right here after the link.
200
00:10:53,550 --> 00:10:57,763
Right? So after the link and before these product details.
201
00:10:59,890 --> 00:11:03,923
So a div, and I'm calling it the colors.
202
00:11:07,490 --> 00:11:10,543
Let's just immediately close it so we don't forget it.
203
00:11:11,600 --> 00:11:16,240
Because this editor is not as good as VS Code.
204
00:11:16,240 --> 00:11:18,000
But it's still quite helpful
205
00:11:18,000 --> 00:11:21,600
to actually use CodePen for something like this.
206
00:11:21,600 --> 00:11:25,563
And now we will just create another div in here.
207
00:11:27,550 --> 00:11:28,383
Color.
208
00:11:30,011 --> 00:11:33,647
And then actually this doesn't have any content at all.
209
00:11:35,740 --> 00:11:36,573
All right.
210
00:11:37,410 --> 00:11:40,943
So this is something we didn't really do before.
211
00:11:42,100 --> 00:11:47,100
And so let me just explain and show you how we will do it.
212
00:11:47,400 --> 00:11:48,890
So we want six colors.
213
00:11:48,890 --> 00:11:51,773
So I'm just a copy pasting it six times.
214
00:11:53,450 --> 00:11:54,890
So yeah.
215
00:11:56,050 --> 00:11:58,540
Let's put that right here at the end.
216
00:11:58,540 --> 00:12:01,690
So just like in the HTML.
217
00:12:01,690 --> 00:12:05,023
So the colors class is not really important, I think.
218
00:12:05,870 --> 00:12:10,560
So let's just start by defining each of the squares.
219
00:12:10,560 --> 00:12:12,410
So each of these.
220
00:12:12,410 --> 00:12:15,170
So basically we make them a square
221
00:12:15,170 --> 00:12:18,730
by giving them a certain height and then a width
222
00:12:18,730 --> 00:12:19,973
which is the same.
223
00:12:22,240 --> 00:12:24,890
So let me show that to you.
224
00:12:24,890 --> 00:12:25,990
The first thing we should do is
225
00:12:25,990 --> 00:12:27,540
to give them a background color
226
00:12:28,640 --> 00:12:30,293
to make it easier to see it.
227
00:12:32,500 --> 00:12:34,533
The first one I think was black.
228
00:12:38,125 --> 00:12:39,090
All right.
229
00:12:39,090 --> 00:12:40,720
But right now they are not visible
230
00:12:40,720 --> 00:12:42,783
because they don't have any content.
231
00:12:43,900 --> 00:12:46,070
But if we give them a height and the width,
232
00:12:46,070 --> 00:12:48,320
then they will become visible.
233
00:12:48,320 --> 00:12:52,220
So let's do that. Height 22 pixels.
234
00:12:52,220 --> 00:12:54,570
And so now immediately they get a height
235
00:12:54,570 --> 00:12:57,900
and then they occupy all the space that they can
236
00:12:57,900 --> 00:13:02,080
because they are block level elements by default, right?
237
00:13:02,080 --> 00:13:04,800
So they are divs and therefore
238
00:13:04,800 --> 00:13:06,733
that is by default a block level.
239
00:13:07,670 --> 00:13:11,400
But now if we specify their width to be the same,
240
00:13:11,400 --> 00:13:14,660
so it looks like a square then,
241
00:13:14,660 --> 00:13:18,730
Well then of course they no longer do that.
242
00:13:18,730 --> 00:13:19,563
Okay.
243
00:13:19,563 --> 00:13:23,740
So of course we are still far away from the final result.
244
00:13:23,740 --> 00:13:26,520
But in order to continue effectively,
245
00:13:26,520 --> 00:13:29,620
let's now give each of them a different color.
246
00:13:29,620 --> 00:13:32,100
So how can we do that?
247
00:13:32,100 --> 00:13:35,760
Well, I will actually add another class to each of them.
248
00:13:35,760 --> 00:13:37,890
And that is completely possible.
249
00:13:37,890 --> 00:13:39,810
Remember that we are allowed
250
00:13:39,810 --> 00:13:42,870
to give each element more than one class.
251
00:13:42,870 --> 00:13:44,820
So I showed you that before.
252
00:13:44,820 --> 00:13:47,470
So the way we do that, is to add a space
253
00:13:47,470 --> 00:13:49,773
and then simply add another one.
254
00:13:51,130 --> 00:13:53,080
So the first one was black,
255
00:13:53,080 --> 00:13:56,233
then blue, red, yellow, green, and brown.
256
00:13:57,670 --> 00:13:58,850
And so,
257
00:13:58,850 --> 00:14:01,690
Well, in the first one, we actually don't need to do that
258
00:14:01,690 --> 00:14:04,160
because they are black already, all of them.
259
00:14:04,160 --> 00:14:06,980
And so we can then basically override that
260
00:14:06,980 --> 00:14:08,143
in all the other ones.
261
00:14:09,960 --> 00:14:13,723
So let's call this one, the color blue.
262
00:14:14,740 --> 00:14:18,823
And then let me just copy-paste that a couple of times.
263
00:14:23,470 --> 00:14:25,003
So red,
264
00:14:27,510 --> 00:14:28,343
yellow,
265
00:14:29,960 --> 00:14:31,350
green,
266
00:14:31,350 --> 00:14:32,690
and
267
00:14:32,690 --> 00:14:33,653
brown.
268
00:14:34,850 --> 00:14:36,010
And now we will of course have
269
00:14:36,010 --> 00:14:38,313
to select all of them right here.
270
00:14:49,620 --> 00:14:50,940
So again, you could have come up
271
00:14:50,940 --> 00:14:53,950
with any blue color that you like.
272
00:14:53,950 --> 00:14:56,630
My choice was this one, 2f6ee2.
273
00:15:01,470 --> 00:15:03,130
So let's see.
274
00:15:03,130 --> 00:15:06,710
And indeed, now it is blue.
275
00:15:06,710 --> 00:15:09,623
Now, we'll just copy this a couple of times.
276
00:15:12,620 --> 00:15:13,563
Okay.
277
00:15:14,840 --> 00:15:15,733
So red,
278
00:15:17,340 --> 00:15:18,270
yellow,
279
00:15:18,270 --> 00:15:19,393
green,
280
00:15:20,890 --> 00:15:22,273
and brown.
281
00:15:25,400 --> 00:15:27,193
So not here, but here.
282
00:15:30,660 --> 00:15:35,593
Here let's use the same red that I had before, actually.
283
00:15:38,840 --> 00:15:40,907
And then the yellow was f0ef1e.
284
00:15:46,050 --> 00:15:48,763
Green is 90cc20.
285
00:15:49,910 --> 00:15:53,973
And finally the brown is 885214.
286
00:15:56,633 --> 00:15:57,950
And there you go.
287
00:15:57,950 --> 00:16:00,620
There we have all six different colors.
288
00:16:00,620 --> 00:16:03,943
Now, all we need to do is to put them side by side.
289
00:16:05,170 --> 00:16:06,993
So how can we do that?
290
00:16:07,960 --> 00:16:11,220
Well, there is a neat trick that we learned before,
291
00:16:11,220 --> 00:16:13,730
which is to change the display property
292
00:16:13,730 --> 00:16:16,313
of these elements to inline block.
293
00:16:18,300 --> 00:16:23,170
So we will now set all of these six elements.
294
00:16:23,170 --> 00:16:26,700
So all of them, which have the class of color
295
00:16:26,700 --> 00:16:29,480
to inline block.
296
00:16:29,480 --> 00:16:32,620
Because like this, they will only occupy the space
297
00:16:32,620 --> 00:16:34,980
that they need and they will also
298
00:16:34,980 --> 00:16:38,110
not create any line breaks after them.
299
00:16:38,110 --> 00:16:40,830
And so that is exactly what we want.
300
00:16:40,830 --> 00:16:42,550
Now we could not use inline because
301
00:16:42,550 --> 00:16:46,363
then the height and width wouldn't really work as expected.
302
00:16:47,290 --> 00:16:49,350
Or at least they shouldn't.
303
00:16:49,350 --> 00:16:52,830
And you see that indeed it doesn't work.
304
00:16:52,830 --> 00:16:54,410
So it needs to be inline block
305
00:16:54,410 --> 00:16:56,600
because remember height and width,
306
00:16:56,600 --> 00:16:58,783
do not apply to inline elements.
307
00:16:59,640 --> 00:17:02,240
And now all we need is a small margin
308
00:17:02,240 --> 00:17:04,500
to the right of each of them
309
00:17:05,400 --> 00:17:08,053
of let's say, 12 pixels.
310
00:17:09,120 --> 00:17:10,590
And there we go.
311
00:17:10,590 --> 00:17:14,500
It's a bit too much, maybe. So 10 pixels.
312
00:17:14,500 --> 00:17:16,320
And that's it.
313
00:17:16,320 --> 00:17:18,520
So that's all we need to do.
314
00:17:18,520 --> 00:17:20,370
Well, actually we are missing
315
00:17:20,370 --> 00:17:24,090
like some space here after this anchor.
316
00:17:24,090 --> 00:17:25,590
And remember how we actually
317
00:17:25,590 --> 00:17:27,780
already had this problem before.
318
00:17:27,780 --> 00:17:29,840
So we tried to add some space.
319
00:17:29,840 --> 00:17:33,530
So some margin bottom to this anchor, but it didn't work.
320
00:17:33,530 --> 00:17:36,490
And so the work around was to then add that space
321
00:17:36,490 --> 00:17:39,960
at the top of this heading.
322
00:17:39,960 --> 00:17:41,350
Remember that?
323
00:17:41,350 --> 00:17:45,210
So that's why here these details title, has the margin top.
324
00:17:45,210 --> 00:17:47,470
And by the time we didn't understand
325
00:17:47,470 --> 00:17:52,130
why adding margin bottom to this anchor element didn't work.
326
00:17:52,130 --> 00:17:54,570
But now we actually do.
327
00:17:54,570 --> 00:17:56,863
So let's do that as well.
328
00:17:58,270 --> 00:18:01,250
So that's right here.
329
00:18:01,250 --> 00:18:06,250
So let's add a margin bottom here of 30 pixels,
330
00:18:06,500 --> 00:18:08,770
which will still not work.
331
00:18:08,770 --> 00:18:11,770
But again, we now know why it doesn't work.
332
00:18:11,770 --> 00:18:13,740
And the reason is that,
333
00:18:13,740 --> 00:18:16,580
the anchor element is an inline element.
334
00:18:16,580 --> 00:18:18,380
And on inline elements,
335
00:18:18,380 --> 00:18:22,020
the top and margin bottoms do not apply.
336
00:18:22,020 --> 00:18:24,260
So, to fix that once again,
337
00:18:24,260 --> 00:18:28,090
we need to display this as an inline block.
338
00:18:28,090 --> 00:18:30,140
So, easy enough.
339
00:18:30,140 --> 00:18:34,540
Display inline block,
340
00:18:34,540 --> 00:18:37,280
and there you go.
341
00:18:37,280 --> 00:18:40,793
There we have, our 30 pixels now nicely displayed.
342
00:18:42,390 --> 00:18:43,550
Okay.
343
00:18:43,550 --> 00:18:45,363
And I think with this,
344
00:18:46,650 --> 00:18:51,030
our solution looks exactly the same as our demo.
345
00:18:51,030 --> 00:18:54,913
So we are done now as it looks.
346
00:18:56,530 --> 00:18:59,220
Yep. So, it seems so.
347
00:18:59,220 --> 00:19:01,080
And so, yeah.
348
00:19:01,080 --> 00:19:06,080
That's actually a wraps up this introduction to CSS section.
349
00:19:06,320 --> 00:19:08,980
So one more time, congratulations
350
00:19:08,980 --> 00:19:12,460
for reaching this first part of the course.
351
00:19:12,460 --> 00:19:16,330
And you now have all the fundamentals of HTML and CSS
352
00:19:16,330 --> 00:19:19,770
that you need in order to start building layouts.
353
00:19:19,770 --> 00:19:24,190
Which is actually one of the main parts of CSS.
354
00:19:24,190 --> 00:19:26,950
So there's a whole section waiting about that.
355
00:19:26,950 --> 00:19:29,330
And so once you're done reviewing everything
356
00:19:29,330 --> 00:19:33,590
that we did here, I will see you in that next section.
357
00:19:33,590 --> 00:19:34,823
Once you are ready.
25245
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.