Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,360 --> 00:00:02,193
All right.
2
00:00:02,193 --> 00:00:05,993
So let's now finish up our web app layout.
3
00:00:07,600 --> 00:00:11,463
And let's start by marking up these five buttons here.
4
00:00:12,430 --> 00:00:15,260
So here we have another background color.
5
00:00:15,260 --> 00:00:20,260
So let's immediately grab that here from the violet colors.
6
00:00:22,060 --> 00:00:24,750
So this one is a bit darker.
7
00:00:24,750 --> 00:00:26,950
Let's go actually with the darkest one here.
8
00:00:30,040 --> 00:00:33,250
And so right here, inside of the menu,
9
00:00:33,250 --> 00:00:36,113
I will now replace this with some button elements.
10
00:00:39,450 --> 00:00:40,283
So new
11
00:00:44,210 --> 00:00:45,193
reply,
12
00:00:52,500 --> 00:00:53,333
forward,
13
00:00:56,780 --> 00:00:59,333
mark as unread,
14
00:01:00,670 --> 00:01:05,493
and finally a trash button.
15
00:01:06,580 --> 00:01:07,910
Nice.
16
00:01:07,910 --> 00:01:09,913
So let's put him here,
17
00:01:14,620 --> 00:01:17,770
give them some nice font size
18
00:01:17,770 --> 00:01:21,373
and of course, that background color that we just copied.
19
00:01:23,540 --> 00:01:24,680
Remember on the button
20
00:01:24,680 --> 00:01:26,980
we always need to remove the border
21
00:01:28,320 --> 00:01:32,630
and we also always need to set a cursor to pointer.
22
00:01:32,630 --> 00:01:36,890
So vs code actually already has this abbreviation here
23
00:01:36,890 --> 00:01:39,513
because that is something that we do all the time.
24
00:01:40,600 --> 00:01:41,890
Then also on buttons,
25
00:01:41,890 --> 00:01:46,300
the color does for some reason not get inherited.
26
00:01:46,300 --> 00:01:49,280
So we need to set that manually, even though in the menu,
27
00:01:49,280 --> 00:01:50,653
it is already white.
28
00:01:51,640 --> 00:01:53,640
So we can actually remove that from here
29
00:01:54,710 --> 00:01:56,610
and to make them bigger of course,
30
00:01:56,610 --> 00:01:58,293
let's give them some padding.
31
00:02:00,850 --> 00:02:05,070
So eight pixels and 12 pixels.
32
00:02:05,070 --> 00:02:10,070
So let's take a look and here there are,
33
00:02:10,570 --> 00:02:14,780
and today are centered because these are like text elements.
34
00:02:14,780 --> 00:02:16,410
So inline elements,
35
00:02:16,410 --> 00:02:19,560
and therefore they are treated like texts.
36
00:02:19,560 --> 00:02:23,267
And since we have text align, set to center everywhere,
37
00:02:23,267 --> 00:02:27,063
this also gets then centered inside of this container.
38
00:02:28,040 --> 00:02:29,620
All right?
39
00:02:29,620 --> 00:02:32,070
So let's just make them actually inline blocks
40
00:02:32,070 --> 00:02:34,520
and make the text bold also
41
00:02:36,100 --> 00:02:38,610
font-weight, bold.
42
00:02:38,610 --> 00:02:43,610
And I like to use the display property first
43
00:02:43,720 --> 00:02:46,433
for some reason but you don't have to,
44
00:02:48,270 --> 00:02:51,980
inline-block. Okay?
45
00:02:51,980 --> 00:02:55,290
And now let's actually use flexbox here.
46
00:02:55,290 --> 00:02:58,420
So in order to give them some space between them,
47
00:02:58,420 --> 00:03:01,640
and then I'm actually going to use this example
48
00:03:01,640 --> 00:03:05,173
to show you yet another really cool flexbox trick.
49
00:03:06,140 --> 00:03:10,143
So the parent element of these buttons is this menu.
50
00:03:11,230 --> 00:03:16,230
And so display set to flex, all right.
51
00:03:16,240 --> 00:03:17,793
Let's just check that out.
52
00:03:19,220 --> 00:03:21,113
All right. Nice.
53
00:03:22,230 --> 00:03:26,560
So we have four buttons here and we probably need to get rid
54
00:03:26,560 --> 00:03:28,840
of this padding here in the top.
55
00:03:28,840 --> 00:03:32,883
And then we also want to vertically aligned this, of course.
56
00:03:34,130 --> 00:03:39,080
So that padding is here, so let's remove that menu simply
57
00:03:40,280 --> 00:03:45,280
and then align items, center and gap 12 pixels.
58
00:03:49,840 --> 00:03:52,830
Okay. Nice.
59
00:03:52,830 --> 00:03:56,090
Let's just add also some padding then to the section
60
00:03:57,050 --> 00:03:58,833
here on the left and right side.
61
00:04:00,080 --> 00:04:02,393
And then I finally want to show you something.
62
00:04:03,530 --> 00:04:06,053
So that's oh yeah, that's right here.
63
00:04:07,920 --> 00:04:12,920
So not padding top and bottom and 40 pixels left and right.
64
00:04:16,662 --> 00:04:19,400
And now let's actually select the very last button
65
00:04:19,400 --> 00:04:21,810
to give it that red color.
66
00:04:21,810 --> 00:04:23,800
So since these buttons here
67
00:04:23,800 --> 00:04:28,040
are all button elements inside of one parent container,
68
00:04:28,040 --> 00:04:32,123
we can use our less child pseudo class.
69
00:04:37,090 --> 00:04:41,730
So button and then a different background color,
70
00:04:41,730 --> 00:04:44,893
we're using red for now, but the actual color.
71
00:04:46,520 --> 00:04:48,860
Well, that doesn't really work.
72
00:04:48,860 --> 00:04:50,820
Let's fix that in a second.
73
00:04:50,820 --> 00:04:55,820
Here I'm just going to get some nice pink color here,
74
00:04:55,910 --> 00:04:59,453
which marches just beautifully with this one here.
75
00:05:00,690 --> 00:05:04,750
Oh, of course here I actually forgot to write it.
76
00:05:04,750 --> 00:05:09,750
So last-child and then that color.
77
00:05:14,230 --> 00:05:17,280
So that's red and now it looks almost the same,
78
00:05:17,280 --> 00:05:20,380
but the difference is that this very less element
79
00:05:20,380 --> 00:05:23,510
was moved all the way to the right side.
80
00:05:23,510 --> 00:05:26,100
So how can we do that?
81
00:05:26,100 --> 00:05:28,230
I mean, there's not really a property
82
00:05:28,230 --> 00:05:31,780
that we can use on a container to achieve this.
83
00:05:31,780 --> 00:05:36,330
The closest we could get, but that's still far away
84
00:05:36,330 --> 00:05:41,330
would be justify-content, space-between.
85
00:05:43,592 --> 00:05:47,010
So something like this.
86
00:05:47,010 --> 00:05:50,030
So now we at least have the trash in the very end,
87
00:05:50,030 --> 00:05:54,360
but then the spacing between here is completely messed up.
88
00:05:54,360 --> 00:05:56,020
So that's not what we want,
89
00:05:56,020 --> 00:05:58,910
but instead we want this one to move all the way
90
00:05:58,910 --> 00:06:00,740
to the right side.
91
00:06:00,740 --> 00:06:03,740
So now here comes the trick I was mentioning.
92
00:06:03,740 --> 00:06:08,060
And that trick is to set the margin here on this element
93
00:06:08,060 --> 00:06:10,483
so the left margin to auto.
94
00:06:11,530 --> 00:06:15,330
So then that margin here will automatically be calculated
95
00:06:15,330 --> 00:06:19,330
based well on the width of the container.
96
00:06:19,330 --> 00:06:21,860
So of course, if we then change this,
97
00:06:21,860 --> 00:06:25,033
then the margin here on the left side will change.
98
00:06:27,690 --> 00:06:30,760
And it would also work by setting a margin right
99
00:06:30,760 --> 00:06:31,820
on this one.
100
00:06:31,820 --> 00:06:34,170
But since we already have this one selected,
101
00:06:34,170 --> 00:06:36,913
I'm going to use the margin left here.
102
00:06:38,260 --> 00:06:39,440
Okay?
103
00:06:39,440 --> 00:06:41,293
So that's removed this one here.
104
00:06:42,930 --> 00:06:47,930
And so margin-left set to auto
105
00:06:51,961 --> 00:06:55,593
and there we go, you see?
106
00:06:56,865 --> 00:06:58,165
You can actually see that.
107
00:06:59,430 --> 00:07:04,230
So you see it, that it has a margin of 66.69 pixels,
108
00:07:04,230 --> 00:07:06,990
which is exactly the margin that is necessary
109
00:07:06,990 --> 00:07:08,783
to put that element there.
110
00:07:09,820 --> 00:07:11,740
And of course, if we change this,
111
00:07:11,740 --> 00:07:13,843
then the margin will be smaller.
112
00:07:15,620 --> 00:07:19,633
Well, it looks like it's not somehow.
113
00:07:21,470 --> 00:07:23,253
Let's just make it really small.
114
00:07:28,420 --> 00:07:30,793
Well, that looks strange.
115
00:07:32,930 --> 00:07:36,823
Actually this is the margin, 248 pixels.
116
00:07:40,300 --> 00:07:43,320
And you'll see that now it is getting bigger
117
00:07:43,320 --> 00:07:45,743
and it is actually 863.
118
00:07:46,870 --> 00:07:51,350
So actually 66 was not enough at all.
119
00:07:51,350 --> 00:07:53,330
So that 66.69,
120
00:07:53,330 --> 00:07:56,200
it's actually just the width of the element.
121
00:07:56,200 --> 00:07:58,470
The margin is what we can see down here
122
00:07:58,470 --> 00:08:00,463
in the actual box, model diagram.
123
00:08:02,400 --> 00:08:04,080
Okay. But anyway,
124
00:08:04,080 --> 00:08:06,930
that works nicely and this is a trick
125
00:08:06,930 --> 00:08:08,920
that many people don't know.
126
00:08:08,920 --> 00:08:11,060
And it is a very important one
127
00:08:11,060 --> 00:08:12,983
that I actually use all the time.
128
00:08:14,890 --> 00:08:16,790
But now about this part here,
129
00:08:16,790 --> 00:08:19,560
and this is also easier than it looks
130
00:08:19,560 --> 00:08:24,560
so let's quickly add 10 new boxes here, one for each email.
131
00:08:27,070 --> 00:08:27,903
Okay?
132
00:08:32,860 --> 00:08:37,113
And here, I'm calling them email with the class.
133
00:08:39,100 --> 00:08:43,253
So email one at now, we'll just copy it 10 times.
134
00:08:46,620 --> 00:08:48,320
Just copy of like this
135
00:08:48,320 --> 00:08:53,320
and then prettier we'll actually make it nice for us.
136
00:08:55,650 --> 00:09:00,140
Nine and 10. Okay?
137
00:09:00,140 --> 00:09:01,373
So let's style them.
138
00:09:06,170 --> 00:09:11,170
So email and let's again,
139
00:09:11,560 --> 00:09:14,163
get some gray background color here.
140
00:09:17,280 --> 00:09:18,820
Let's use this one,
141
00:09:18,820 --> 00:09:22,030
which is quite darker than the other one.
142
00:09:22,030 --> 00:09:23,870
So the background color,
143
00:09:23,870 --> 00:09:27,068
and let's get actually this here also some padding of
144
00:09:27,068 --> 00:09:29,610
also 40 pixels,
145
00:09:29,610 --> 00:09:33,573
so that it's aligned with the buttons in the menu bar.
146
00:09:34,660 --> 00:09:36,683
And let's give each of them some height.
147
00:09:37,820 --> 00:09:42,820
So 96 pixels and that should already look quite good.
148
00:09:44,850 --> 00:09:46,263
So here we are.
149
00:09:47,160 --> 00:09:50,520
And now of course our layout did grow vertically
150
00:09:50,520 --> 00:09:54,320
in order to make space for all of these elements here.
151
00:09:54,320 --> 00:09:56,010
So by default, of course,
152
00:09:56,010 --> 00:09:59,860
they do not show this behavior with the scroll bar,
153
00:09:59,860 --> 00:10:02,360
but instead they take up all of this space
154
00:10:02,360 --> 00:10:05,300
and therefore this second row of the grid,
155
00:10:05,300 --> 00:10:09,653
then needs to grow in order to accommodate for that space.
156
00:10:10,790 --> 00:10:13,740
Now let's also actually create some spacing
157
00:10:13,740 --> 00:10:16,680
between these elements and for that,
158
00:10:16,680 --> 00:10:19,170
I want to use the gap property.
159
00:10:19,170 --> 00:10:22,030
Remember how we can do that vertically.
160
00:10:22,030 --> 00:10:24,930
So of course, remember that by default,
161
00:10:24,930 --> 00:10:29,880
the gap property applies horizontally like here, right?
162
00:10:29,880 --> 00:10:32,230
But if we want to use it vertically,
163
00:10:32,230 --> 00:10:34,680
then we can still use flexbox.
164
00:10:34,680 --> 00:10:37,760
All you have to do is to change the flex direction
165
00:10:37,760 --> 00:10:39,793
from row to column.
166
00:10:41,100 --> 00:10:45,960
So we did as before in this section, I think even twice.
167
00:10:45,960 --> 00:10:47,800
And so if you don't remember that,
168
00:10:47,800 --> 00:10:51,120
I even did a very nice visual representation
169
00:10:51,120 --> 00:10:52,810
of that change.
170
00:10:52,810 --> 00:10:56,830
And so maybe you can find that in one of the first lectures
171
00:10:56,830 --> 00:10:58,190
in the section.
172
00:10:58,190 --> 00:10:59,320
But anyway,
173
00:10:59,320 --> 00:11:03,350
the flex container of these email items here
174
00:11:03,350 --> 00:11:05,380
is of course the section.
175
00:11:05,380 --> 00:11:09,230
And so let's make this a flex container.
176
00:11:09,230 --> 00:11:13,440
And then we wanted a gap property of 40 pixels.
177
00:11:13,440 --> 00:11:15,080
And just as a review,
178
00:11:15,080 --> 00:11:18,973
let's see what happens if we do not specify flex direction.
179
00:11:20,150 --> 00:11:23,790
So then of course they are side by side like this
180
00:11:23,790 --> 00:11:26,163
and with the gap applied horizontally.
181
00:11:27,990 --> 00:11:29,530
And so now, as I was saying,
182
00:11:29,530 --> 00:11:33,970
what we need to do is to change this to column
183
00:11:35,480 --> 00:11:38,960
and nice, that looks nice.
184
00:11:38,960 --> 00:11:43,960
Let's just center the text here also inside of each email,
185
00:11:43,970 --> 00:11:47,473
because with that, we can practice some more flexbox.
186
00:11:48,390 --> 00:11:53,390
And remember that this works basically because flexbox
187
00:11:53,600 --> 00:11:58,340
treats texts as a flex item. Okay.
188
00:11:58,340 --> 00:12:01,206
And so we can use align-item, center
189
00:12:01,206 --> 00:12:04,370
and justify-content, center.
190
00:12:04,370 --> 00:12:06,390
So this, we have done many times,
191
00:12:06,390 --> 00:12:09,660
so hopefully these three lines of flexbox
192
00:12:09,660 --> 00:12:12,713
are already nicely inside of your brain.
193
00:12:14,370 --> 00:12:15,900
All right.
194
00:12:15,900 --> 00:12:18,400
And so now it is time for the trick where
195
00:12:18,400 --> 00:12:21,610
we want this element here to not grow larger
196
00:12:21,610 --> 00:12:24,630
than the content. All right?
197
00:12:24,630 --> 00:12:27,450
So by default, of course, this element here,
198
00:12:27,450 --> 00:12:29,230
so this container element
199
00:12:29,230 --> 00:12:32,560
had simply the size of this grid row.
200
00:12:32,560 --> 00:12:35,600
But then we put all of these elements into it
201
00:12:35,600 --> 00:12:37,870
and so then it grew bigger to accommodate
202
00:12:37,870 --> 00:12:39,650
for all that content.
203
00:12:39,650 --> 00:12:43,223
But we can make it so that it does not grow.
204
00:12:44,830 --> 00:12:48,250
So that's right here, it's the section element.
205
00:12:48,250 --> 00:12:53,250
And so we can say overflow and then set to scroll.
206
00:12:56,200 --> 00:12:59,540
Now this alone will not fix it because
207
00:12:59,540 --> 00:13:01,810
since this is now a flex container,
208
00:13:01,810 --> 00:13:05,470
what this will do instead of giving us the scroll bar
209
00:13:05,470 --> 00:13:09,050
is to basically shrink these flex items
210
00:13:09,050 --> 00:13:12,683
because by default, flex shrink is set to one.
211
00:13:13,810 --> 00:13:16,010
So again, by default,
212
00:13:16,010 --> 00:13:20,087
flex items are allowed to shrink if necessary, right?
213
00:13:21,470 --> 00:13:23,388
But we can turn that off by
214
00:13:23,388 --> 00:13:26,460
going to all of these flex items
215
00:13:26,460 --> 00:13:29,653
and then in there set flex shrink to zero.
216
00:13:31,582 --> 00:13:33,700
But this one is of course only necessary
217
00:13:33,700 --> 00:13:35,980
because we are using flexbox.
218
00:13:35,980 --> 00:13:37,900
If we were not using flexbox,
219
00:13:37,900 --> 00:13:41,750
then this one here would be enough, okay?
220
00:13:41,750 --> 00:13:43,230
So just keep that in mind,
221
00:13:43,230 --> 00:13:46,073
this property has nothing to do with flexbox.
222
00:13:47,510 --> 00:13:50,023
This has been in CSS for a long time.
223
00:13:52,639 --> 00:13:55,430
And so now we are back to, if I'm scrolling here,
224
00:13:55,430 --> 00:13:58,910
nothing happens because now this grid row here
225
00:13:58,910 --> 00:14:01,490
is back to just being one fr
226
00:14:02,410 --> 00:14:05,970
so basically only occupying this space here
227
00:14:05,970 --> 00:14:10,292
and then here we made it so that any content that overflowed
228
00:14:10,292 --> 00:14:12,763
would gets some scroll bar.
229
00:14:15,148 --> 00:14:17,010
Now here, instead of scroll,
230
00:14:17,010 --> 00:14:20,850
one of the other things we use all the time is hidden.
231
00:14:20,850 --> 00:14:25,080
And so in this case, then the content that was overflowing
232
00:14:25,080 --> 00:14:28,060
so that it overflow and did no longer fit here,
233
00:14:28,060 --> 00:14:29,293
simply disappears.
234
00:14:30,130 --> 00:14:33,690
So now I'm scrolling here, but well,
235
00:14:33,690 --> 00:14:35,593
these other items are simply hidden.
236
00:14:37,040 --> 00:14:38,140
Okay?
237
00:14:38,140 --> 00:14:40,970
But in this case, that's not what we want.
238
00:14:40,970 --> 00:14:43,070
Sometimes it is.
239
00:14:43,070 --> 00:14:45,810
But in this case we want scroll,
240
00:14:45,810 --> 00:14:47,493
let me actually write that here.
241
00:14:48,540 --> 00:14:53,060
So how elements that don't fit
242
00:14:53,060 --> 00:14:56,863
into container appear.
243
00:15:00,197 --> 00:15:02,060
Now we're back to scrolling.
244
00:15:02,060 --> 00:15:06,029
And so now our nice little layout here is finished
245
00:15:06,029 --> 00:15:08,200
and it looks quite nice.
246
00:15:08,200 --> 00:15:10,410
So I'm really happy with this result
247
00:15:10,410 --> 00:15:12,710
and I hope that you are too.
248
00:15:12,710 --> 00:15:13,543
All right.
249
00:15:13,543 --> 00:15:15,730
And so right now, at this point,
250
00:15:15,730 --> 00:15:19,363
we studied so much HTML and so much CSS
251
00:15:19,363 --> 00:15:22,520
things like flexbox and CSS Grid.
252
00:15:22,520 --> 00:15:26,120
But of course also all the other CSS properties
253
00:15:26,120 --> 00:15:29,080
that we are now ready to start working
254
00:15:29,080 --> 00:15:33,130
on our big and final project of this course.
255
00:15:33,130 --> 00:15:35,320
Just make sure before you moved there,
256
00:15:35,320 --> 00:15:39,400
that you did actually understand everything that we did here
257
00:15:39,400 --> 00:15:42,520
because we will use most of the things
258
00:15:42,520 --> 00:15:46,110
or maybe even all of the things that we learned until now
259
00:15:46,110 --> 00:15:47,950
in this big project.
260
00:15:47,950 --> 00:15:50,430
But then once you're done reviewing everything,
261
00:15:50,430 --> 00:15:54,003
I can't wait to show you that project in the next section.
18963
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.