Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,420 --> 00:00:02,470
All right.
2
00:00:02,470 --> 00:00:06,000
Now in part three of building the meals section
3
00:00:06,000 --> 00:00:08,900
let's quickly build our diet list
4
00:00:08,900 --> 00:00:12,293
and also work on some other smaller details.
5
00:00:13,780 --> 00:00:15,810
But before we do any of that,
6
00:00:15,810 --> 00:00:18,560
I actually noticed that we have a small bug
7
00:00:18,560 --> 00:00:20,600
here in our code.
8
00:00:20,600 --> 00:00:23,210
So when we hover over this button here,
9
00:00:23,210 --> 00:00:26,870
notice that we have a weird effect here with this border.
10
00:00:26,870 --> 00:00:29,253
So especially when we move the mouse out.
11
00:00:31,170 --> 00:00:35,140
So watch how, that kind of happens immediately.
12
00:00:35,140 --> 00:00:36,220
Right?
13
00:00:36,220 --> 00:00:39,730
So the background color does fade out and in,
14
00:00:39,730 --> 00:00:41,520
but not at the border.
15
00:00:41,520 --> 00:00:44,280
And so that's an error that we have
16
00:00:46,900 --> 00:00:48,143
in the hero section.
17
00:00:50,750 --> 00:00:52,720
Or actually that's not in the hero section.
18
00:00:52,720 --> 00:00:56,880
That's here in the general file where our button is.
19
00:00:56,880 --> 00:00:58,810
And the problem is that...
20
00:01:00,960 --> 00:01:01,840
Yeah, here.
21
00:01:01,840 --> 00:01:03,000
So here in the button,
22
00:01:03,000 --> 00:01:05,730
we transition only to background color,
23
00:01:05,730 --> 00:01:08,223
but well, not the shadow.
24
00:01:09,750 --> 00:01:13,310
So box shadow is what creates that border.
25
00:01:13,310 --> 00:01:16,530
So that's the trick that I showed you back here.
26
00:01:16,530 --> 00:01:19,880
And so right now that box shadow property
27
00:01:19,880 --> 00:01:23,830
is not transitioned, but only the background color.
28
00:01:23,830 --> 00:01:26,340
And so we should not do this.
29
00:01:26,340 --> 00:01:30,450
So I'm duplicating it and then commenting this one.
30
00:01:30,450 --> 00:01:34,540
But instead let's simply transition all properties.
31
00:01:34,540 --> 00:01:37,790
And so that's the reason why I always simply by default
32
00:01:37,790 --> 00:01:42,790
use all because then a bug like that can never happen.
33
00:01:43,040 --> 00:01:47,810
So with bug, we mean mistakes in programming, right?
34
00:01:47,810 --> 00:01:50,760
And so now it looks a lot more fluent.
35
00:01:50,760 --> 00:01:53,270
And so it just as expected.
36
00:01:53,270 --> 00:01:56,150
But anyway, moving back down here,
37
00:01:56,150 --> 00:01:58,563
let's now add our list here.
38
00:02:02,030 --> 00:02:05,210
So we already have that div element here.
39
00:02:05,210 --> 00:02:08,963
And so now let's simply create that unordered list here.
40
00:02:11,060 --> 00:02:13,710
And actually this is the one that I want to call list
41
00:02:14,670 --> 00:02:19,180
and this one let's call it diets.
42
00:02:19,180 --> 00:02:20,580
Okay.
43
00:02:20,580 --> 00:02:25,090
And now each list item should have like an icon,
44
00:02:25,090 --> 00:02:26,690
for example, a check mark.
45
00:02:26,690 --> 00:02:31,690
And then besides that it might have what we'll have
46
00:02:31,960 --> 00:02:36,023
then these list of diets.
47
00:02:37,550 --> 00:02:39,030
Right?
48
00:02:39,030 --> 00:02:44,030
So let's basically wrap each of them inside of an li.
49
00:02:48,270 --> 00:02:51,713
And well, that doesn't work so nice.
50
00:02:52,560 --> 00:02:55,223
So I'm just gonna copy that everywhere.
51
00:02:56,800 --> 00:03:01,800
So using multiple cursors by hitting alt or option,
52
00:03:03,950 --> 00:03:07,070
and then again, it does these automatically,
53
00:03:07,070 --> 00:03:09,470
but then we can move here to the end of the line
54
00:03:10,950 --> 00:03:13,143
and that's a lot better.
55
00:03:14,600 --> 00:03:15,433
Okay.
56
00:03:18,350 --> 00:03:20,193
So there is our list.
57
00:03:22,010 --> 00:03:26,400
Let's just actually add also a class to each of them here.
58
00:03:26,400 --> 00:03:29,160
So I'm again using multiple cursors
59
00:03:29,160 --> 00:03:31,063
by hitting the option or alt key,
60
00:03:31,950 --> 00:03:35,700
and then we can write in multiple places at the same time.
61
00:03:35,700 --> 00:03:38,460
So once more, a very, very handy trick
62
00:03:38,460 --> 00:03:40,113
that we can use in VS code.
63
00:03:41,840 --> 00:03:42,860
Okay.
64
00:03:42,860 --> 00:03:46,350
And actually, I'm also gonna need these multiple cursors
65
00:03:46,350 --> 00:03:50,033
because I now also want to insert the icon here.
66
00:03:50,920 --> 00:03:52,453
So for now let's take a look.
67
00:03:53,668 --> 00:03:55,950
And of course, nothing changed.
68
00:03:55,950 --> 00:03:57,930
So we just edit the class.
69
00:03:57,930 --> 00:04:01,860
But now, yeah, it's quite typical for a list like this
70
00:04:01,860 --> 00:04:04,390
to use a check mark icon.
71
00:04:04,390 --> 00:04:06,970
So if I just search for that here,
72
00:04:06,970 --> 00:04:09,390
then there is one for sure.
73
00:04:09,390 --> 00:04:12,160
So we actually have multiple options here.
74
00:04:12,160 --> 00:04:14,300
So we're using a lot of circles.
75
00:04:14,300 --> 00:04:16,210
So we could go with this one,
76
00:04:16,210 --> 00:04:18,990
but I think that this is a lot cleaner.
77
00:04:18,990 --> 00:04:21,070
So that's actually this one here.
78
00:04:21,070 --> 00:04:22,943
So check mark outline.
79
00:04:25,070 --> 00:04:28,160
And now I simply paste it everywhere.
80
00:04:28,160 --> 00:04:29,570
Right?
81
00:04:29,570 --> 00:04:30,900
So it is everywhere.
82
00:04:30,900 --> 00:04:33,030
And then at once the rest of the content
83
00:04:33,030 --> 00:04:35,263
to be inside of a span element.
84
00:04:36,200 --> 00:04:38,393
So I can very simply do that.
85
00:04:39,920 --> 00:04:42,963
And then again, it created this.
86
00:04:44,880 --> 00:04:46,680
Oh, and now it doesn't work so well.
87
00:04:48,430 --> 00:04:53,430
So now let me just close that here and then copy that.
88
00:04:59,880 --> 00:05:01,540
So this looks like a mess now.
89
00:05:01,540 --> 00:05:05,060
So you need to be careful with where exactly you close
90
00:05:05,060 --> 00:05:06,133
your elements.
91
00:05:07,540 --> 00:05:10,823
So it's right after each of these words.
92
00:05:13,800 --> 00:05:17,290
But then once we have the automatic formatting
93
00:05:17,290 --> 00:05:21,910
coming from prettier, it should look a lot clearer.
94
00:05:21,910 --> 00:05:23,480
And there we go.
95
00:05:23,480 --> 00:05:27,070
So each of the li has one eye and i an icon element
96
00:05:27,070 --> 00:05:29,100
and one span element.
97
00:05:29,100 --> 00:05:32,303
And each of them has then the diet name.
98
00:05:33,370 --> 00:05:37,060
So I think this does look correct.
99
00:05:37,060 --> 00:05:38,723
Let's quickly check that out.
100
00:05:40,460 --> 00:05:43,073
And somehow it always goes back to the top now.
101
00:05:44,830 --> 00:05:46,100
And yeah.
102
00:05:46,100 --> 00:05:47,790
So there are our icons.
103
00:05:47,790 --> 00:05:51,170
And so let's now visually format all of this.
104
00:05:51,170 --> 00:05:54,490
And the first thing that we should do is to get rid
105
00:05:54,490 --> 00:05:57,743
of the bullet points there.
106
00:06:00,010 --> 00:06:01,653
So let's come down here.
107
00:06:03,810 --> 00:06:05,223
Now that's very simple.
108
00:06:06,120 --> 00:06:08,543
List-style, none.
109
00:06:11,260 --> 00:06:12,093
Okay.
110
00:06:13,030 --> 00:06:17,080
Then let's also of course, style the icons.
111
00:06:17,080 --> 00:06:19,633
Oh, and here I forgot to add another class.
112
00:06:20,890 --> 00:06:23,310
So again, I'm using multiple cursors here
113
00:06:23,310 --> 00:06:24,903
just to make it easier.
114
00:06:26,900 --> 00:06:29,630
And there are actually even better techniques,
115
00:06:29,630 --> 00:06:32,393
but that would be a bit too much here.
116
00:06:33,610 --> 00:06:38,033
So class and then a list-icon.
117
00:06:38,960 --> 00:06:39,793
Okay.
118
00:06:45,890 --> 00:06:48,800
So width, let's use 30 pixels
119
00:06:48,800 --> 00:06:50,850
and then the height needs to be the same.
120
00:06:53,180 --> 00:06:56,320
And remember at here we actually need to use the color
121
00:06:56,320 --> 00:07:00,790
in order to style the color of this icon.
122
00:07:00,790 --> 00:07:01,743
Okay.
123
00:07:03,030 --> 00:07:04,030
Nice.
124
00:07:04,030 --> 00:07:06,040
So that's the icons,
125
00:07:06,040 --> 00:07:09,520
but now of course, we need to make the text bigger.
126
00:07:09,520 --> 00:07:13,393
So let's do that here in list-item.
127
00:07:16,920 --> 00:07:20,570
So font size and them again, using 1.8 rem,
128
00:07:20,570 --> 00:07:23,633
which is kind of a standard that we use in many places.
129
00:07:24,840 --> 00:07:26,100
Right.
130
00:07:26,100 --> 00:07:29,363
And then we should vertically align all of this.
131
00:07:30,360 --> 00:07:33,333
Right. So the icon with the text.
132
00:07:34,250 --> 00:07:37,453
And so let's just make this here a flex container.
133
00:07:38,390 --> 00:07:42,380
Because once again this list item here is the parent
134
00:07:42,380 --> 00:07:45,290
of this icon end of the span.
135
00:07:45,290 --> 00:07:49,053
So just what we also had here before in this list elements.
136
00:07:51,150 --> 00:07:52,540
So display flex
137
00:07:56,310 --> 00:07:58,423
align items of center,
138
00:08:00,640 --> 00:08:04,483
and let's of course also add some gap between the two.
139
00:08:05,510 --> 00:08:07,180
Okay.
140
00:08:07,180 --> 00:08:08,540
Nice.
141
00:08:08,540 --> 00:08:10,040
So we have to spacing here.
142
00:08:10,040 --> 00:08:13,970
Now of course we need to spacing also between the elements.
143
00:08:13,970 --> 00:08:15,020
And so once again,
144
00:08:15,020 --> 00:08:18,963
I'm now using the trick of using flex direction column.
145
00:08:20,020 --> 00:08:22,863
So that's again, very similar to what we did before.
146
00:08:25,030 --> 00:08:29,857
So display flex, flex direction column,
147
00:08:31,940 --> 00:08:36,203
and then let's also use 1.6 rem for the gap.
148
00:08:37,980 --> 00:08:40,540
Okay, beautiful.
149
00:08:40,540 --> 00:08:42,250
So that's looking great.
150
00:08:42,250 --> 00:08:45,260
Let's just add a title here.
151
00:08:45,260 --> 00:08:49,260
Let's see if there is one in the content.
152
00:08:49,260 --> 00:08:52,653
And well, let's just use what they already have here.
153
00:08:54,750 --> 00:08:58,370
So only food works with any diet.
154
00:08:58,370 --> 00:09:02,220
And then here let's do that before this list,
155
00:09:02,220 --> 00:09:05,520
but of course still inside of this container.
156
00:09:05,520 --> 00:09:07,120
So this diets element,
157
00:09:07,120 --> 00:09:10,560
which is basically this column in the grid.
158
00:09:10,560 --> 00:09:15,560
So again, using the h3 with the heading tertiary class
159
00:09:16,770 --> 00:09:18,443
that we already created before.
160
00:09:19,530 --> 00:09:21,063
So I think that was the name.
161
00:09:24,160 --> 00:09:26,163
And if not, we can just fix that.
162
00:09:27,260 --> 00:09:28,203
Colon here.
163
00:09:29,300 --> 00:09:31,030
And nice.
164
00:09:31,030 --> 00:09:34,390
Now the Omnifood here is maybe a bit too much
165
00:09:34,390 --> 00:09:38,800
because if we remove that and had just works with any diet,
166
00:09:38,800 --> 00:09:42,170
then that would fit probably just in one line,
167
00:09:42,170 --> 00:09:44,253
which would look a lot better.
168
00:09:45,430 --> 00:09:47,763
So works with any diet.
169
00:09:48,930 --> 00:09:49,763
Yeah.
170
00:09:49,763 --> 00:09:50,870
That's beautiful.
171
00:09:50,870 --> 00:09:53,720
And the spacing is also already nice,
172
00:09:53,720 --> 00:09:57,130
which is because this is the exact same element
173
00:09:57,130 --> 00:10:00,023
or it has the exact same styling as this one.
174
00:10:01,750 --> 00:10:02,583
Okay.
175
00:10:02,583 --> 00:10:06,923
And so there lies the power of reusability across the page.
176
00:10:08,520 --> 00:10:09,353
Okay.
177
00:10:09,353 --> 00:10:11,020
So this looks good,
178
00:10:11,020 --> 00:10:13,740
but actually I want to add another thing.
179
00:10:13,740 --> 00:10:17,250
And that is just like a small link here
180
00:10:17,250 --> 00:10:22,250
in the end of the section which can lead us to all recipes.
181
00:10:22,940 --> 00:10:25,740
So let's say that this year are like the sample meals,
182
00:10:25,740 --> 00:10:28,620
but that the user wanted to see what meals
183
00:10:28,620 --> 00:10:31,130
are actually available in Omnifood.
184
00:10:31,130 --> 00:10:32,990
And so then after these simple meals,
185
00:10:32,990 --> 00:10:36,850
there might be a link that will lead to a different page.
186
00:10:36,850 --> 00:10:39,130
So we will not build that page of course,
187
00:10:39,130 --> 00:10:41,653
but we can still add a link here below.
188
00:10:43,000 --> 00:10:43,833
Okay.
189
00:10:45,950 --> 00:10:49,590
So we want to do that in the same section,
190
00:10:49,590 --> 00:10:52,333
but outside of this div here.
191
00:10:53,370 --> 00:10:56,140
So let's select that because then it will select
192
00:10:56,140 --> 00:11:00,570
the one at the top so that we can see what's happening.
193
00:11:00,570 --> 00:11:03,920
So we want it to happen after this container.
194
00:11:03,920 --> 00:11:04,753
Right?
195
00:11:04,753 --> 00:11:06,340
So after this grid,
196
00:11:06,340 --> 00:11:10,570
so that simply add another div there and another container,
197
00:11:10,570 --> 00:11:12,850
because we also want this one to be centered
198
00:11:12,850 --> 00:11:13,813
in the view port.
199
00:11:15,250 --> 00:11:16,810
So div class
200
00:11:18,820 --> 00:11:19,903
container,
201
00:11:23,890 --> 00:11:27,623
and that's also called us all recipes.
202
00:11:29,460 --> 00:11:32,960
So here, all I'm gonna do is to add a link
203
00:11:32,960 --> 00:11:35,890
that is not going to point anywhere.
204
00:11:35,890 --> 00:11:38,523
And I will add to class of link.
205
00:11:39,560 --> 00:11:40,980
So here, what I want to do
206
00:11:40,980 --> 00:11:44,320
is to basically create a generic link element
207
00:11:44,320 --> 00:11:48,630
that we could once again, reuse all over our page.
208
00:11:48,630 --> 00:11:51,260
So see all recipes.
209
00:11:51,260 --> 00:11:54,540
And then here, I like to use that right arrow.
210
00:11:54,540 --> 00:11:55,373
So rarr.
211
00:11:58,130 --> 00:12:02,020
So that's an HTML entity that I use all the time.
212
00:12:02,020 --> 00:12:04,350
And so I already know it by heart.
213
00:12:04,350 --> 00:12:06,000
But on my resources page,
214
00:12:06,000 --> 00:12:09,410
there is a link to a page which contains a utlist
215
00:12:09,410 --> 00:12:12,720
of all the relevant HTML entities.
216
00:12:12,720 --> 00:12:13,553
All right.
217
00:12:14,640 --> 00:12:17,760
Now, of course for now that doesn't look great.
218
00:12:17,760 --> 00:12:19,860
So let's fix a couple of things
219
00:12:19,860 --> 00:12:22,623
starting actually with a spacing, maybe.
220
00:12:23,950 --> 00:12:27,360
So how can we add spacing here?
221
00:12:27,360 --> 00:12:29,990
I mean, this element here,
222
00:12:29,990 --> 00:12:34,990
all of this is a container and a row or actually a grid.
223
00:12:36,130 --> 00:12:39,800
So just as we saw before, let's go back there.
224
00:12:39,800 --> 00:12:43,840
So we have container grid and grid-3-columns.
225
00:12:43,840 --> 00:12:46,850
And so to now add some margin here to the bottom,
226
00:12:46,850 --> 00:12:51,170
we would have to create another class for that margin.
227
00:12:51,170 --> 00:12:52,020
Right?
228
00:12:52,020 --> 00:12:54,540
So we don't want to add any margin
229
00:12:54,540 --> 00:12:58,150
to any of this reusable classes here.
230
00:12:58,150 --> 00:12:59,050
Right?
231
00:12:59,050 --> 00:13:03,320
Because we want them to be basically as neutral as possible.
232
00:13:03,320 --> 00:13:06,750
So we could add another help or class here.
233
00:13:06,750 --> 00:13:09,320
So a little bit like we did before.
234
00:13:09,320 --> 00:13:11,043
And actually let's do that.
235
00:13:11,970 --> 00:13:14,563
So we did that here with one of the buttons.
236
00:13:16,010 --> 00:13:16,843
Yeah.
237
00:13:16,843 --> 00:13:19,300
So here at the margin, write small.
238
00:13:19,300 --> 00:13:22,710
Because we had the same situation where we didn't want
239
00:13:22,710 --> 00:13:26,860
to add any margin to any of these button classes here.
240
00:13:26,860 --> 00:13:30,260
Again, because they should be reusable.
241
00:13:30,260 --> 00:13:31,600
Right?
242
00:13:31,600 --> 00:13:34,403
So let's not do another helper class,
243
00:13:35,990 --> 00:13:37,190
which I'm gonna call
244
00:13:39,300 --> 00:13:44,300
margin bottom and let's call it MD for medium.
245
00:13:49,610 --> 00:13:52,113
And here I'm gonna use 4.8 rem.
246
00:13:54,870 --> 00:13:57,150
And again, using the important keywords
247
00:13:57,150 --> 00:14:00,260
so that it really will apply.
248
00:14:00,260 --> 00:14:02,483
And so now if we add this class here,
249
00:14:06,100 --> 00:14:11,100
so yeah, so to this grid and this container here,
250
00:14:13,100 --> 00:14:15,853
then that will add that margin.
251
00:14:17,800 --> 00:14:20,100
Okay? And here it is.
252
00:14:20,100 --> 00:14:21,620
Right?
253
00:14:21,620 --> 00:14:23,230
So hopefully that made sense.
254
00:14:23,230 --> 00:14:26,210
And you understood why we did create
255
00:14:26,210 --> 00:14:27,963
that new special class here.
256
00:14:29,120 --> 00:14:32,820
Right? Now we could have done it in another way also.
257
00:14:32,820 --> 00:14:36,030
For example, simply adding a margin top
258
00:14:36,030 --> 00:14:38,653
to all the recipes right here.
259
00:14:39,610 --> 00:14:40,443
Right?
260
00:14:40,443 --> 00:14:42,810
So that would also have been possible,
261
00:14:42,810 --> 00:14:45,503
but I like to use the reusable way.
262
00:14:49,690 --> 00:14:54,690
So let's create the all-recipes here
263
00:14:54,690 --> 00:14:56,100
and let's center the text
264
00:14:58,130 --> 00:15:02,803
and let's also give it a fun size off again, 1.8 rem.
265
00:15:05,060 --> 00:15:09,500
And I'm putting the font size here and not on the link.
266
00:15:09,500 --> 00:15:12,860
And I'm doing that for the same reasons as before.
267
00:15:12,860 --> 00:15:15,700
So that maybe I will want to reuse this link
268
00:15:15,700 --> 00:15:18,260
on other places in the page.
269
00:15:18,260 --> 00:15:20,950
And then I don't want to have it always
270
00:15:20,950 --> 00:15:24,090
with a font size of 1.8 rem.
271
00:15:24,090 --> 00:15:24,950
So somewhere else,
272
00:15:24,950 --> 00:15:29,150
maybe a better font size for a link will be 1.4 rem.
273
00:15:29,150 --> 00:15:34,120
And so then if we had this fixed size, we could not do that.
274
00:15:34,120 --> 00:15:37,820
And so by setting the font size here then the to link.
275
00:15:37,820 --> 00:15:41,750
So the anchor element will simply inherit that size.
276
00:15:41,750 --> 00:15:42,683
And here it is.
277
00:15:43,570 --> 00:15:44,870
Right?
278
00:15:44,870 --> 00:15:46,800
And now of course, we need to style this,
279
00:15:46,800 --> 00:15:51,800
to adapt it to the rest of the visual style of our page.
280
00:15:52,080 --> 00:15:54,133
And so let's do that right here.
281
00:15:55,540 --> 00:15:57,653
So after this button, maybe.
282
00:16:00,870 --> 00:16:02,460
So link.
283
00:16:02,460 --> 00:16:06,093
Well, that should be first link link.
284
00:16:09,440 --> 00:16:12,253
And then the visited pseudo class.
285
00:16:13,400 --> 00:16:15,230
And here, the first thing that I want to do
286
00:16:15,230 --> 00:16:18,963
is to give it a burnt orange color.
287
00:16:20,200 --> 00:16:23,300
Then I want to remove the text decoration,
288
00:16:23,300 --> 00:16:25,040
set it to none.
289
00:16:25,040 --> 00:16:29,050
But then I actually want to recreate something similar.
290
00:16:29,050 --> 00:16:31,970
So let's just see what we have right now.
291
00:16:31,970 --> 00:16:34,690
And so of course now there is no underlining,
292
00:16:34,690 --> 00:16:39,170
but usually links do have some underline, right?
293
00:16:39,170 --> 00:16:43,370
However, usually we do not use text decoration for that,
294
00:16:43,370 --> 00:16:48,000
but recreate it using a border because as I will show you,
295
00:16:48,000 --> 00:16:49,623
that looks a lot nicer.
296
00:16:50,980 --> 00:16:52,920
So let's do that.
297
00:16:52,920 --> 00:16:57,730
So border bottom, one pixel solid
298
00:16:58,590 --> 00:17:01,490
and then the color of the border.
299
00:17:01,490 --> 00:17:04,750
And now here, let me show you yet another trick.
300
00:17:04,750 --> 00:17:09,280
So instead of writing the exact same color as we have here,
301
00:17:09,280 --> 00:17:11,700
which is the color that we want.
302
00:17:11,700 --> 00:17:14,810
So instead of doing this, we can do something else
303
00:17:14,810 --> 00:17:19,810
which is to write the current color keywords.
304
00:17:21,140 --> 00:17:24,620
And so what this will do is that it will take the color
305
00:17:24,620 --> 00:17:27,480
that is currently the text color.
306
00:17:27,480 --> 00:17:28,313
Okay?
307
00:17:28,313 --> 00:17:31,140
And so then we don't have to repeat the same color
308
00:17:31,140 --> 00:17:33,080
and that is especially helpful
309
00:17:33,080 --> 00:17:35,600
if for some reason we changed the color,
310
00:17:35,600 --> 00:17:38,530
for example, on a hover state.
311
00:17:38,530 --> 00:17:39,363
Okay?
312
00:17:40,600 --> 00:17:43,460
So for now it doesn't look so good yet.
313
00:17:43,460 --> 00:17:44,940
So that's okay.
314
00:17:44,940 --> 00:17:47,730
But what usually we do when we design a link
315
00:17:47,730 --> 00:17:50,193
is to then give it some petting at the bottom.
316
00:17:51,080 --> 00:17:55,500
So petting bottom, and then something really small,
317
00:17:55,500 --> 00:17:56,823
like two pixels.
318
00:17:58,320 --> 00:18:00,010
And if we want to use petting,
319
00:18:00,010 --> 00:18:03,513
we also need to set this to an inline block.
320
00:18:05,280 --> 00:18:06,113
Right.
321
00:18:07,150 --> 00:18:09,240
And so let's check that out.
322
00:18:09,240 --> 00:18:11,070
Now that looks kind of the same.
323
00:18:11,070 --> 00:18:13,253
So let's inspect that here.
324
00:18:18,990 --> 00:18:21,410
Oh, Well, that actually makes a difference.
325
00:18:21,410 --> 00:18:23,910
So these two pixels that we have here,
326
00:18:23,910 --> 00:18:27,033
and if we had the text decoration, it would be right here.
327
00:18:28,440 --> 00:18:30,780
So that does not look ideal.
328
00:18:30,780 --> 00:18:33,990
And so this is why everyone does it like this.
329
00:18:33,990 --> 00:18:36,780
So we removed the text decoration
330
00:18:36,780 --> 00:18:38,773
and then do it in this way.
331
00:18:39,820 --> 00:18:40,653
All right.
332
00:18:45,210 --> 00:18:49,493
And now as for the hover and active states,
333
00:18:51,040 --> 00:18:55,240
which as you'll see, we usually always group together,
334
00:18:55,240 --> 00:18:57,070
but we wouldn't have to, of course.
335
00:18:57,070 --> 00:18:58,490
They could be different
336
00:18:58,490 --> 00:19:01,760
and we did that in the very first project,
337
00:19:01,760 --> 00:19:05,643
but again, it's very common to see them being together.
338
00:19:06,950 --> 00:19:07,870
Okay.
339
00:19:07,870 --> 00:19:12,250
So here let's change the color simply to the darker color,
340
00:19:12,250 --> 00:19:13,503
which is this one.
341
00:19:14,780 --> 00:19:15,800
Okay.
342
00:19:15,800 --> 00:19:18,050
And then as we hover over it,
343
00:19:18,050 --> 00:19:22,890
watch how the border also changes to the same color.
344
00:19:22,890 --> 00:19:23,723
Right.
345
00:19:23,723 --> 00:19:26,970
And so that's because we use the current color trick.
346
00:19:26,970 --> 00:19:28,200
So that keyword.
347
00:19:28,200 --> 00:19:31,580
And so now, yeah, it always automatically
348
00:19:31,580 --> 00:19:34,293
has the exact same color as the text.
349
00:19:35,200 --> 00:19:36,190
Right?
350
00:19:36,190 --> 00:19:38,820
However, in this case we actually don't
351
00:19:38,820 --> 00:19:40,860
want the underline anymore.
352
00:19:40,860 --> 00:19:44,460
So that's another common style that is common to use
353
00:19:44,460 --> 00:19:45,470
on links.
354
00:19:45,470 --> 00:19:50,470
So when we hover them, we remove the border at the bottom.
355
00:19:50,640 --> 00:19:51,473
Right.
356
00:19:52,430 --> 00:19:57,333
However, we cannot just say border bottom, none for example.
357
00:19:58,400 --> 00:19:59,600
And let me show you why.
358
00:20:00,790 --> 00:20:02,550
So you see it, that the entire layout
359
00:20:02,550 --> 00:20:06,680
jumps a little bit by one pixel, right?
360
00:20:06,680 --> 00:20:09,110
And so that is because that one pixel
361
00:20:09,110 --> 00:20:11,450
is actually part of the element.
362
00:20:11,450 --> 00:20:13,940
And so when we removed that on hover,
363
00:20:13,940 --> 00:20:15,840
then the element becomes smaller.
364
00:20:15,840 --> 00:20:20,340
And then while that messes up to spacing of the entire page.
365
00:20:20,340 --> 00:20:22,770
and in this case, it is just one pixel,
366
00:20:22,770 --> 00:20:25,970
but still it will create a noticeable effect.
367
00:20:25,970 --> 00:20:27,390
As you can see here,
368
00:20:27,390 --> 00:20:31,490
or maybe you can experiment it on your own computer.
369
00:20:31,490 --> 00:20:36,090
And so instead what we do is to keep it at one pixel still
370
00:20:36,090 --> 00:20:40,460
solid, but instead of giving it a real color
371
00:20:40,460 --> 00:20:43,240
we use the transparent keyboards.
372
00:20:43,240 --> 00:20:44,470
Okay.
373
00:20:44,470 --> 00:20:47,590
And so here you just learned another important keywords
374
00:20:47,590 --> 00:20:49,350
for colors.
375
00:20:49,350 --> 00:20:52,920
And so that will now fix that problem.
376
00:20:52,920 --> 00:20:54,220
Okay.
377
00:20:54,220 --> 00:20:58,840
Now, just to finish, let's make this animate here as well.
378
00:20:58,840 --> 00:21:01,363
And so on the, a normal state,
379
00:21:02,820 --> 00:21:07,820
we use the transition property with all and set it to,
380
00:21:07,830 --> 00:21:12,380
let's again, use 0.3 seconds.
381
00:21:12,380 --> 00:21:13,213
Okay.
382
00:21:14,230 --> 00:21:16,100
So that looks very nice.
383
00:21:16,100 --> 00:21:19,083
And so now let's analyze our entire section here.
384
00:21:20,340 --> 00:21:23,890
So I think it looks really, really good,
385
00:21:23,890 --> 00:21:26,100
like professionally designed,
386
00:21:26,100 --> 00:21:29,193
but we can still improve just a small detail here.
387
00:21:30,130 --> 00:21:31,570
So right now,
388
00:21:31,570 --> 00:21:35,320
due to the fact that we have this link here centered,
389
00:21:35,320 --> 00:21:37,740
we can see some imbalance here.
390
00:21:37,740 --> 00:21:40,620
So all of this looks a bit centered here as well,
391
00:21:40,620 --> 00:21:42,490
and then also the link,
392
00:21:42,490 --> 00:21:47,210
but then we have this year aligned to the left side, right?
393
00:21:47,210 --> 00:21:51,540
So it's aligned to the left, just like here as well.
394
00:21:51,540 --> 00:21:54,780
And so to make this one a bit different from the first one,
395
00:21:54,780 --> 00:21:57,840
and also to add some balance to the section,
396
00:21:57,840 --> 00:22:00,610
we can also center all of this.
397
00:22:00,610 --> 00:22:02,110
And as you will see,
398
00:22:02,110 --> 00:22:05,250
this will then create a really nice effect.
399
00:22:05,250 --> 00:22:09,103
So making it a little bit different than the other section.
400
00:22:10,900 --> 00:22:11,833
All right.
401
00:22:12,810 --> 00:22:14,320
So to center that text,
402
00:22:14,320 --> 00:22:17,653
we have to come here to where it is defined.
403
00:22:18,960 --> 00:22:20,890
So that's right here.
404
00:22:20,890 --> 00:22:24,520
Now, how can we actually center this text here?
405
00:22:24,520 --> 00:22:28,280
So of course, we do not want to add text align center
406
00:22:28,280 --> 00:22:30,470
on these two, right?
407
00:22:30,470 --> 00:22:32,220
And once again,
408
00:22:32,220 --> 00:22:35,840
that is because these are supposed to be reusable.
409
00:22:35,840 --> 00:22:38,543
So instead we can simply center,
410
00:22:39,480 --> 00:22:43,220
so we can simply set the text align center property
411
00:22:43,220 --> 00:22:45,580
on the container here.
412
00:22:45,580 --> 00:22:46,580
Right.
413
00:22:46,580 --> 00:22:48,770
And so that's exactly what I will do.
414
00:22:48,770 --> 00:22:52,143
And I will create another helper class here.
415
00:22:54,340 --> 00:22:56,420
So let me actually write that here.
416
00:22:56,420 --> 00:23:00,110
So helper classes,
417
00:23:00,110 --> 00:23:04,463
or we can also call them like settings classes.
418
00:23:05,810 --> 00:23:10,300
So these are small helper classes that have just one
419
00:23:10,300 --> 00:23:11,550
declaration.
420
00:23:11,550 --> 00:23:16,030
So I'm calling this one here, let's call it center text,
421
00:23:16,030 --> 00:23:19,350
and then text the line center.
422
00:23:19,350 --> 00:23:21,773
And so now I can simply add that here.
423
00:23:25,140 --> 00:23:26,560
So center text,
424
00:23:26,560 --> 00:23:31,160
and then these two elements will actually inherit that.
425
00:23:31,160 --> 00:23:32,380
Right.
426
00:23:32,380 --> 00:23:35,633
We could also put it directly here and here.
427
00:23:36,540 --> 00:23:39,410
Well here, actually I think it would not work
428
00:23:39,410 --> 00:23:43,823
because this is an inline element, unless we change that.
429
00:23:45,170 --> 00:23:46,920
Well, let's see if we actually did.
430
00:23:49,140 --> 00:23:51,400
Oh yeah, we set it to a block.
431
00:23:51,400 --> 00:23:56,400
So we could actually also set centered text here, but well,
432
00:23:56,670 --> 00:23:58,370
it's simpler to simply put it here
433
00:23:58,370 --> 00:24:00,863
and then have these two elements inherited.
434
00:24:02,730 --> 00:24:03,847
Okay.
435
00:24:03,847 --> 00:24:05,050
And so once again,
436
00:24:05,050 --> 00:24:09,600
we created this helper classier for the sake of reusability.
437
00:24:09,600 --> 00:24:11,460
So to make these two reusable,
438
00:24:11,460 --> 00:24:14,183
instead of having that right there.
439
00:24:15,640 --> 00:24:16,610
Okay?
440
00:24:16,610 --> 00:24:19,140
And so now this entire section here looks
441
00:24:19,140 --> 00:24:22,043
like it is really centered on the page.
442
00:24:23,360 --> 00:24:24,193
Okay?
443
00:24:24,193 --> 00:24:25,050
And so with this,
444
00:24:25,050 --> 00:24:27,950
we could now say that we finished this section,
445
00:24:27,950 --> 00:24:31,200
but I just want to show you one more thing.
446
00:24:31,200 --> 00:24:35,430
So I want to add a nice hover effect here
447
00:24:35,430 --> 00:24:37,290
on these two cards.
448
00:24:37,290 --> 00:24:41,270
So that's something that we would not have to do, but yeah.
449
00:24:41,270 --> 00:24:43,930
I want to show you more and more things here.
450
00:24:43,930 --> 00:24:47,610
So let me just quickly show you how we can do that
451
00:24:47,610 --> 00:24:49,453
in just one line of CSS.
452
00:24:53,360 --> 00:24:57,010
So that's something that I think we have never done before,
453
00:24:57,010 --> 00:25:00,970
which is to use hover on something that is not a link,
454
00:25:00,970 --> 00:25:03,253
but we can of course, perfectly do that.
455
00:25:06,700 --> 00:25:10,420
So we have meal, which is the entire cart,
456
00:25:10,420 --> 00:25:14,943
and then we can use the hover pseudo class on that one.
457
00:25:16,380 --> 00:25:19,620
So the effect that I want to implement here is that
458
00:25:19,620 --> 00:25:22,640
whenever we hover over this element,
459
00:25:22,640 --> 00:25:26,440
I want the entire element to move up a little bit.
460
00:25:26,440 --> 00:25:27,870
All right.
461
00:25:27,870 --> 00:25:30,860
So again, I'm sure you have seen this in action
462
00:25:30,860 --> 00:25:32,830
somewhere on the web.
463
00:25:32,830 --> 00:25:35,360
And so for this, so far moving up,
464
00:25:35,360 --> 00:25:37,850
I like to use the transform property
465
00:25:37,850 --> 00:25:40,640
with the translate value.
466
00:25:40,640 --> 00:25:42,980
So we have used translate before,
467
00:25:42,980 --> 00:25:46,020
remember that a couple of times.
468
00:25:46,020 --> 00:25:48,500
And so here we have to define two values
469
00:25:48,500 --> 00:25:51,490
where the first one is for horizontal movement.
470
00:25:51,490 --> 00:25:55,560
And the second one is for a vertical movement.
471
00:25:55,560 --> 00:26:00,560
So for example, we can say 2 rem, 2 rem here, right?
472
00:26:02,360 --> 00:26:05,440
So again, horizontal, which is like X,
473
00:26:05,440 --> 00:26:08,660
and then the second is vertical which is Y,
474
00:26:08,660 --> 00:26:10,653
sort of X and Y axis.
475
00:26:11,960 --> 00:26:14,810
So of course this will not be what we want,
476
00:26:14,810 --> 00:26:19,370
but you see that once we hover it it does happen.
477
00:26:19,370 --> 00:26:23,113
So it does move 20 pixels down and to the right.
478
00:26:24,410 --> 00:26:25,510
Okay?
479
00:26:25,510 --> 00:26:27,840
However, I only want to move it up.
480
00:26:27,840 --> 00:26:30,350
So only in the Y direction.
481
00:26:30,350 --> 00:26:35,260
And so here, actually we can use the translate Y property.
482
00:26:35,260 --> 00:26:39,640
And so then we only define a the Y property.
483
00:26:39,640 --> 00:26:40,923
So the vertical one.
484
00:26:42,120 --> 00:26:42,953
Right?
485
00:26:45,400 --> 00:26:48,530
So that is a bit better already.
486
00:26:48,530 --> 00:26:51,623
So just in one direction, but I wanted to go up.
487
00:26:52,460 --> 00:26:54,663
So that's minus two.
488
00:26:57,010 --> 00:26:57,970
Okay.
489
00:26:57,970 --> 00:26:59,960
But that's also a little bit too much
490
00:26:59,960 --> 00:27:03,750
because this effect should be something very subtle.
491
00:27:03,750 --> 00:27:07,450
And of course also there should be an animation.
492
00:27:07,450 --> 00:27:08,283
Right.
493
00:27:09,170 --> 00:27:13,010
So 1.2 rem here and now the animation.
494
00:27:13,010 --> 00:27:16,113
Now, how do you think we can do that animation?
495
00:27:17,090 --> 00:27:20,040
Well, once again, that's very simple.
496
00:27:20,040 --> 00:27:23,330
All we have to do is to use the transition property
497
00:27:23,330 --> 00:27:25,630
on the original state.
498
00:27:25,630 --> 00:27:26,623
So that's this one.
499
00:27:29,230 --> 00:27:33,730
So transition all, and now let's go a bit higher.
500
00:27:33,730 --> 00:27:37,660
So the bigger the element the longer we can animate it.
501
00:27:37,660 --> 00:27:40,913
So let's now use 0.4 seconds this time.
502
00:27:43,170 --> 00:27:44,590
Okay.
503
00:27:44,590 --> 00:27:45,820
Nice.
504
00:27:45,820 --> 00:27:48,670
That looks quite nice, actually.
505
00:27:48,670 --> 00:27:50,160
Great.
506
00:27:50,160 --> 00:27:53,080
And now just as a very final touch,
507
00:27:53,080 --> 00:27:56,060
let's also manipulate the shadow here a little bit
508
00:27:56,060 --> 00:28:00,070
to make this effect look a bit more realistic.
509
00:28:00,070 --> 00:28:03,150
So by moving up the element, we kind of simulate it
510
00:28:03,150 --> 00:28:06,530
moving closer to the source of the light.
511
00:28:06,530 --> 00:28:07,363
Right.
512
00:28:07,363 --> 00:28:10,453
And so therefore the shadow can then become a bit larger.
513
00:28:11,750 --> 00:28:14,417
So let's do that.
514
00:28:14,417 --> 00:28:16,283
And I will just copy this here.
515
00:28:18,750 --> 00:28:20,280
So right here.
516
00:28:20,280 --> 00:28:22,030
And so we will make it larger.
517
00:28:22,030 --> 00:28:26,300
So let's move one step up here to 3.2 rem
518
00:28:26,300 --> 00:28:31,300
and here to 64 so to 6.4 rem.
519
00:28:32,060 --> 00:28:34,930
And then we should also make it a bit lighter.
520
00:28:34,930 --> 00:28:37,930
So a shadow that is more diffused and bigger
521
00:28:37,930 --> 00:28:41,253
basically also naturally should be lighter.
522
00:28:43,500 --> 00:28:48,360
And again, these things you will learn them with practice.
523
00:28:48,360 --> 00:28:49,193
Right.
524
00:28:50,494 --> 00:28:51,960
All right.
525
00:28:51,960 --> 00:28:54,130
So that's very subtle actually.
526
00:28:54,130 --> 00:28:57,670
But if you notice then the shadow does change a little bit.
527
00:28:57,670 --> 00:29:00,213
And this makes it more natural, indeed.
528
00:29:01,630 --> 00:29:05,760
Okay. And so, yeah, that's it for this section.
529
00:29:05,760 --> 00:29:09,510
once again, very beautiful, very nice looking, I think.
530
00:29:09,510 --> 00:29:13,130
And our page is really coming together here.
531
00:29:13,130 --> 00:29:15,350
So we have this beautiful section.
532
00:29:15,350 --> 00:29:19,410
This one here is very gorgeous as well.
533
00:29:19,410 --> 00:29:22,060
And of course also our header.
534
00:29:22,060 --> 00:29:24,390
So hope you're having a lot of fun here
535
00:29:24,390 --> 00:29:26,900
and that you are starting to become really proud
536
00:29:26,900 --> 00:29:28,950
of what you're building here.
537
00:29:28,950 --> 00:29:30,520
And yeah.
538
00:29:30,520 --> 00:29:34,120
Once you're ready observing this beautiful project
539
00:29:34,120 --> 00:29:37,750
then let's move together to our next section
540
00:29:37,750 --> 00:29:40,163
because there is still a long way to go.
38257
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.