Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,760 --> 00:00:02,733
All right.
2
00:00:03,608 --> 00:00:05,970
Let's now finish working on our form
3
00:00:05,970 --> 00:00:08,773
by now styling all the input elements.
4
00:00:10,400 --> 00:00:12,280
And the first thing that I want to do
5
00:00:13,189 --> 00:00:14,439
is to style these labels.
6
00:00:15,817 --> 00:00:18,710
So basically putting them on top here of the inputs
7
00:00:18,710 --> 00:00:20,893
and of course, making them a lot bigger.
8
00:00:23,014 --> 00:00:24,580
Now, notice how I didn't give all of these
9
00:00:24,580 --> 00:00:27,800
form elements here class names,
10
00:00:27,800 --> 00:00:30,690
because they already have so many attributes,
11
00:00:30,690 --> 00:00:33,730
and so adding a class on top of that
12
00:00:33,730 --> 00:00:35,573
would make them even more confused.
13
00:00:37,365 --> 00:00:39,420
So that's why usually when they build forms,
14
00:00:39,420 --> 00:00:42,143
I simply select deform,
15
00:00:43,311 --> 00:00:46,163
and then from there, I simply use the descendant selector.
16
00:00:48,511 --> 00:00:49,344
So CTA form.
17
00:00:50,609 --> 00:00:52,073
And so we will style the label.
18
00:00:53,430 --> 00:00:54,793
Let's duplicate this here.
19
00:00:56,243 --> 00:00:57,793
So we will also style the input
20
00:00:59,461 --> 00:01:02,560
and also the select element,
21
00:01:02,560 --> 00:01:05,163
and actually also here at the button.
22
00:01:06,430 --> 00:01:10,670
So this button already has this class, but as you saw,
23
00:01:10,670 --> 00:01:14,300
it doesn't actually look like any of the other buttons,
24
00:01:14,300 --> 00:01:16,543
and we will see soon why that is.
25
00:01:17,662 --> 00:01:20,600
But you can, if you want, already start thinking about that,
26
00:01:20,600 --> 00:01:21,733
if you feel like it.
27
00:01:24,548 --> 00:01:27,590
So anyway, we're going to start with the label, as I said,
28
00:01:27,590 --> 00:01:29,683
and to give it its own line,
29
00:01:30,562 --> 00:01:34,020
all we have to do is to set it as a block level element,
30
00:01:34,020 --> 00:01:35,350
right?
31
00:01:35,350 --> 00:01:37,020
So that will then put the label
32
00:01:37,858 --> 00:01:40,053
and the input each on its own line.
33
00:01:42,590 --> 00:01:44,973
Then, let's increase the font size of course,
34
00:01:46,078 --> 00:01:47,983
to something that we can actually read,
35
00:01:49,376 --> 00:01:52,612
and the font weight a little bit bigger,
36
00:01:52,612 --> 00:01:54,562
but not too overwhelming.
37
00:01:54,562 --> 00:01:59,130
So just 500, and a little bit of margin to the bottom.
38
00:02:02,223 --> 00:02:04,978
So that's a very nice improvement already.
39
00:02:04,978 --> 00:02:07,028
And of course, they still work as before.
40
00:02:09,172 --> 00:02:11,960
So moving back, now it's time to work on these ones here,
41
00:02:11,960 --> 00:02:15,143
and especially of course increasing their size,
42
00:02:16,449 --> 00:02:18,149
so increasing their width,
43
00:02:18,149 --> 00:02:20,349
and also adding some padding inside of them.
44
00:02:26,197 --> 00:02:30,093
So, first of all, we can give them a width of 100%,
45
00:02:31,011 --> 00:02:33,713
which will have them occupy their entire parent.
46
00:02:36,660 --> 00:02:39,350
Then let's add that padding that I just mentioned,
47
00:02:39,350 --> 00:02:40,653
but not too much.
48
00:02:41,730 --> 00:02:44,590
Just 1.2 rem here, so 12 pixels.
49
00:02:44,590 --> 00:02:47,243
And then we can also increase their font size.
50
00:02:49,434 --> 00:02:51,197
So the font of the text
51
00:02:51,197 --> 00:02:53,433
that we will write inside of the input field.
52
00:02:54,318 --> 00:02:56,268
So that's a good start I think for now.
53
00:02:57,166 --> 00:03:01,560
And then from there we can improve it even further, right?
54
00:03:01,560 --> 00:03:05,330
So this looks better already, but if you look closely,
55
00:03:05,330 --> 00:03:09,930
you will notice that font family here inside of these
56
00:03:09,930 --> 00:03:13,403
two fields is actually different from this one here.
57
00:03:14,684 --> 00:03:17,564
So what this means is that these input fields,
58
00:03:17,564 --> 00:03:20,020
for some reason, do not inherit the font family
59
00:03:20,020 --> 00:03:23,793
from the body element where we defined it, right?
60
00:03:25,245 --> 00:03:27,451
So all of the other elements, remember,
61
00:03:27,451 --> 00:03:28,770
they all have the same font family
62
00:03:28,770 --> 00:03:32,140
because they simply inherited from the body element
63
00:03:32,140 --> 00:03:34,323
where we defined it, right?
64
00:03:35,485 --> 00:03:38,750
But again, input elements and also this button here
65
00:03:39,725 --> 00:03:42,210
and also this select one here,
66
00:03:42,210 --> 00:03:45,040
all of them do not inherit that.
67
00:03:45,040 --> 00:03:47,838
All right, however,
68
00:03:47,838 --> 00:03:49,370
we can actually force these elements
69
00:03:49,370 --> 00:03:51,683
to also inherit to font family.
70
00:03:54,446 --> 00:03:55,960
So how can we do that?
71
00:03:55,960 --> 00:03:59,418
Well, there is yet another CSS keyword
72
00:03:59,418 --> 00:04:02,218
that we haven't learned about, and it is called inherit.
73
00:04:05,115 --> 00:04:08,440
So basically what this does is exactly what it says here.
74
00:04:08,440 --> 00:04:12,610
It says so that it should inherit the font family
75
00:04:12,610 --> 00:04:15,933
from whatever parent element is relevant in this case.
76
00:04:17,380 --> 00:04:18,213
All right.
77
00:04:19,213 --> 00:04:22,266
And we can use this in all kinds of situations,
78
00:04:22,266 --> 00:04:24,853
so not just for font family, but let's see.
79
00:04:26,364 --> 00:04:28,503
And notice how it is now really different.
80
00:04:30,428 --> 00:04:33,743
Of course, we can see that, like this.
81
00:04:35,131 --> 00:04:38,233
So if we turn it off, see how it changes dramatically.
82
00:04:39,520 --> 00:04:40,353
Right?
83
00:04:42,029 --> 00:04:43,594
But as I was saying,
84
00:04:43,594 --> 00:04:46,244
we can use this keyword also in different situations.
85
00:04:47,755 --> 00:04:50,853
So for example, remember how here in the secondary heading,
86
00:04:51,921 --> 00:04:54,260
we set the color here to this one.
87
00:04:54,260 --> 00:04:58,394
So the same one that is already in its parent element,
88
00:04:58,394 --> 00:05:00,363
CTA text box, right?
89
00:05:01,439 --> 00:05:02,989
Because if we didn't have this,
90
00:05:03,852 --> 00:05:06,427
then the heading secondary would simply use
91
00:05:06,427 --> 00:05:07,843
the gray color that it had before.
92
00:05:08,930 --> 00:05:10,329
Right?
93
00:05:10,329 --> 00:05:11,415
See that?
94
00:05:11,415 --> 00:05:13,320
So it is now again, gray.
95
00:05:13,320 --> 00:05:18,320
However, we could also use color inherit here again,
96
00:05:19,440 --> 00:05:24,440
because CTA text box is the parent element of this heading,
97
00:05:25,100 --> 00:05:26,863
secondary in this case here,
98
00:05:27,979 --> 00:05:29,579
so the one that's inside of CTA.
99
00:05:30,508 --> 00:05:32,960
And so, if then here we set color to inherit,
100
00:05:32,960 --> 00:05:35,433
it will automatically inherit that color.
101
00:05:37,323 --> 00:05:39,523
And so you see, now it's back to this color.
102
00:05:40,827 --> 00:05:45,700
And of course, if we set this one here to red,
103
00:05:45,700 --> 00:05:47,733
then all the texts would become red.
104
00:05:49,340 --> 00:05:53,340
So this one, of course, and yeah, this one as well,
105
00:05:53,340 --> 00:05:56,009
because we forced it to inherit the color
106
00:05:56,009 --> 00:05:57,133
from its parent element.
107
00:05:59,147 --> 00:06:02,640
So a very, very handy and useful keyword that
108
00:06:02,640 --> 00:06:06,053
you should keep handy in your mind, basically.
109
00:06:09,590 --> 00:06:10,973
But moving on now,
110
00:06:10,973 --> 00:06:13,755
let's remove the default border of that is present
111
00:06:13,755 --> 00:06:15,534
on all input fields.
112
00:06:15,534 --> 00:06:18,301
And also to decrease the contrast a little bit
113
00:06:18,301 --> 00:06:21,900
between the background color of the CTA box
114
00:06:21,900 --> 00:06:23,383
and the element itself,
115
00:06:24,427 --> 00:06:26,653
I will add some background color to this one.
116
00:06:30,237 --> 00:06:31,953
So just our very lightest version here.
117
00:06:33,436 --> 00:06:37,733
So here, and then also let's add some border radius.
118
00:06:39,738 --> 00:06:42,325
So we have been using 11 and nine pixels.
119
00:06:42,325 --> 00:06:44,429
And for this one, I'm going with nine
120
00:06:44,429 --> 00:06:46,029
because it is a smaller element.
121
00:06:48,070 --> 00:06:48,903
Okay.
122
00:06:50,220 --> 00:06:52,120
So that looks even better than before.
123
00:06:53,580 --> 00:06:56,350
Now, there's just one small thing that we can do,
124
00:06:56,350 --> 00:06:59,030
which is to add a very, very small,
125
00:06:59,030 --> 00:07:01,993
and very subtle shadow here to these elements,
126
00:07:02,940 --> 00:07:05,890
which is something that I like to do a lot on input fields.
127
00:07:07,022 --> 00:07:08,926
So let me just show that to you,
128
00:07:08,926 --> 00:07:10,410
so that you can see the difference that it makes,
129
00:07:10,410 --> 00:07:13,623
which is quite significant, even though it is quite subtle.
130
00:07:15,643 --> 00:07:17,030
So box shadow,
131
00:07:17,030 --> 00:07:20,323
and of course, horizontally, we don't want any,
132
00:07:21,418 --> 00:07:23,168
and also vertically, just one pixel
133
00:07:24,297 --> 00:07:28,593
and a blur, just two pixel, and then let's make it black.
134
00:07:30,892 --> 00:07:32,489
Let's choose.
135
00:07:32,489 --> 00:07:33,322
Well, maybe 10%.
136
00:07:34,910 --> 00:07:36,250
All right.
137
00:07:36,250 --> 00:07:38,070
And there you see it.
138
00:07:38,070 --> 00:07:41,390
So it's hard to see, but probably on your computer,
139
00:07:41,390 --> 00:07:42,813
you can see it just fine.
140
00:07:43,754 --> 00:07:46,680
And it does make a lot of difference actually here.
141
00:07:46,680 --> 00:07:49,045
All right, next up.
142
00:07:49,045 --> 00:07:50,550
One thing that we can also style,
143
00:07:50,550 --> 00:07:53,740
is the color here of this placeholder.
144
00:07:53,740 --> 00:07:55,803
So right now, it looks quite dark.
145
00:07:56,697 --> 00:07:59,630
It almost looks as though, that this was the real content.
146
00:07:59,630 --> 00:08:02,090
So I always make this a lot lighter
147
00:08:03,417 --> 00:08:08,030
and we can do that by using a new pseudo-element.
148
00:08:09,863 --> 00:08:13,993
So CTA form input,
149
00:08:15,221 --> 00:08:17,465
so basically the same as here
150
00:08:17,465 --> 00:08:20,593
and then we can select the pseudo-element of placeholder.
151
00:08:22,436 --> 00:08:23,436
So this one.
152
00:08:24,340 --> 00:08:27,463
So remember pseudo-elements are basically elements
153
00:08:27,463 --> 00:08:29,335
that we can select and style,
154
00:08:29,335 --> 00:08:32,265
but which do not really exist on the page.
155
00:08:32,265 --> 00:08:35,750
So like a first line or a first letter or, well,
156
00:08:35,750 --> 00:08:36,613
the placeholder.
157
00:08:38,906 --> 00:08:40,460
And so here let's use a light color
158
00:08:41,702 --> 00:08:43,693
and it doesn't have to be accessible in this case.
159
00:08:44,540 --> 00:08:46,083
Let's just go with this one.
160
00:08:47,546 --> 00:08:50,183
So again, one of these simple ones to select,
161
00:08:50,183 --> 00:08:52,730
which has the exact same value in all the three,
162
00:08:52,730 --> 00:08:56,713
and so therefore in all the six positions of the hex code.
163
00:08:59,447 --> 00:09:00,673
So that's a lot nicer.
164
00:09:01,812 --> 00:09:04,210
And now let's talk about this one here.
165
00:09:04,210 --> 00:09:06,510
So this box that opens up here
166
00:09:07,496 --> 00:09:11,236
actually depends on the operating system that you're using.
167
00:09:11,236 --> 00:09:14,471
So if you're on Mac, yours should look something like this,
168
00:09:14,471 --> 00:09:17,560
but on Windows, it will look completely different.
169
00:09:17,560 --> 00:09:20,410
And I believe there's not really a way of styling it,
170
00:09:20,410 --> 00:09:24,150
but of course we can style this part here.
171
00:09:24,150 --> 00:09:28,603
And in fact it is almost the same as the input itself,
172
00:09:30,437 --> 00:09:31,333
as well as the input element.
173
00:09:32,341 --> 00:09:34,700
And so we can simply add that here to the list.
174
00:09:34,700 --> 00:09:38,163
So CTA form select.
175
00:09:40,809 --> 00:09:41,642
Okay.
176
00:09:42,667 --> 00:09:44,329
So nice.
177
00:09:44,329 --> 00:09:48,050
So it looks exactly like these two now in terms of size.
178
00:09:48,050 --> 00:09:49,343
It has the same shadow.
179
00:09:50,473 --> 00:09:51,510
And then when we opened this now,
180
00:09:51,510 --> 00:09:55,780
it actually has the same width as the select element,
181
00:09:55,780 --> 00:09:59,210
but again, the colors and all that stuff here,
182
00:09:59,210 --> 00:10:00,603
we can not manipulate.
183
00:10:01,544 --> 00:10:04,253
It will simply depend on the user's operating system.
184
00:10:05,340 --> 00:10:06,670
All right.
185
00:10:06,670 --> 00:10:09,080
Just one thing that you might notice here
186
00:10:09,080 --> 00:10:11,363
is that the text is completely black.
187
00:10:12,548 --> 00:10:13,831
And so once again,
188
00:10:13,831 --> 00:10:15,370
this one here doesn't inherit the color
189
00:10:15,370 --> 00:10:17,293
that we select for our document.
190
00:10:18,758 --> 00:10:19,900
And the same as actually true here.
191
00:10:19,900 --> 00:10:22,310
So if we write something here,
192
00:10:22,310 --> 00:10:24,780
notice how the text is completely black.
193
00:10:24,780 --> 00:10:29,630
And so, we need to force the color here
194
00:10:29,630 --> 00:10:31,283
to also get inherited.
195
00:10:35,902 --> 00:10:36,789
Right?
196
00:10:36,789 --> 00:10:38,865
So just like we did with the font family,
197
00:10:38,865 --> 00:10:40,325
we are now also forcing
198
00:10:40,325 --> 00:10:42,375
the color to get inherited from the body.
199
00:10:44,609 --> 00:10:45,442
So with this,
200
00:10:46,611 --> 00:10:48,220
well actually it's not inherited from the body,
201
00:10:48,220 --> 00:10:49,824
but in this case,
202
00:10:49,824 --> 00:10:52,250
it is inherited from this CTA box here
203
00:10:52,250 --> 00:10:55,030
where we set the color to this brown.
204
00:10:55,030 --> 00:10:58,560
And so, indeed here it is now brown.
205
00:10:58,560 --> 00:11:01,463
And also when we write here, it's no longer black.
206
00:11:02,550 --> 00:11:07,090
And now finally, let's talk about our button here.
207
00:11:07,090 --> 00:11:11,083
So this button here doesn't have any styling whatsoever yet,
208
00:11:11,985 --> 00:11:15,800
even though we did actually add the button class to it,
209
00:11:15,800 --> 00:11:16,820
right?
210
00:11:16,820 --> 00:11:20,113
So why is there none of the styles
211
00:11:20,113 --> 00:11:22,063
from this class applying to our button?
212
00:11:23,861 --> 00:11:27,323
Well, let's answer that by actually going there.
213
00:11:29,917 --> 00:11:31,753
And so here is the answer.
214
00:11:33,845 --> 00:11:34,843
So this style here,
215
00:11:36,163 --> 00:11:38,833
so this CSS rule only applies to buttons.
216
00:11:39,873 --> 00:11:42,973
So two elements with the class of button that are links.
217
00:11:44,067 --> 00:11:46,161
And so remember that this means
218
00:11:46,161 --> 00:11:49,540
that they need to have the href attribute, right?
219
00:11:49,540 --> 00:11:52,530
It also applies to buttons that have been visited,
220
00:11:52,530 --> 00:11:55,993
but of that also doesn't apply to our button here.
221
00:11:58,068 --> 00:12:01,521
So this button here does not have any href attribute.
222
00:12:01,521 --> 00:12:05,900
And so therefore it is not selected by this and not by this.
223
00:12:05,900 --> 00:12:09,783
And so that's why it doesn't have any of these styles here.
224
00:12:11,430 --> 00:12:15,583
So, to fix that, we can simply add that to the list here.
225
00:12:17,186 --> 00:12:18,986
So basically just the simple button,
226
00:12:20,029 --> 00:12:22,893
but without any of these pseudo-classes.
227
00:12:24,431 --> 00:12:27,306
And so now it should get at least some styles.
228
00:12:27,306 --> 00:12:28,638
So that looks different,
229
00:12:28,638 --> 00:12:30,813
but of course still far from being perfect.
230
00:12:32,294 --> 00:12:33,537
So first of all,
231
00:12:33,537 --> 00:12:35,650
let's remove the ugly border here
232
00:12:35,650 --> 00:12:38,693
and we also need to give it the hand cursor.
233
00:12:40,541 --> 00:12:43,390
And so that, we can actually also do here,
234
00:12:43,390 --> 00:12:46,373
even though these other buttons don't need it, but still,
235
00:12:47,228 --> 00:12:49,963
there's not a problem in putting it here for all of them.
236
00:12:51,663 --> 00:12:56,663
So, no border and the cursor should be the pointer.
237
00:12:59,440 --> 00:13:00,750
Let's just write that here
238
00:13:05,359 --> 00:13:07,203
for the btn itself.
239
00:13:09,301 --> 00:13:10,917
Now, right?
240
00:13:10,917 --> 00:13:12,230
And also the font family,
241
00:13:12,230 --> 00:13:14,383
I'm not sure if it is being inherited.
242
00:13:15,969 --> 00:13:17,569
I think it does look like it is.
243
00:13:20,358 --> 00:13:21,283
We can just try it here.
244
00:13:23,454 --> 00:13:24,454
Font family inherit.
245
00:13:26,540 --> 00:13:31,023
But yeah, that does look the same, I think, but anyway,
246
00:13:32,140 --> 00:13:35,023
let's actually leave it there now, right?
247
00:13:37,713 --> 00:13:39,113
So that's it for the button.
248
00:13:40,261 --> 00:13:42,073
So for the general styles for this button,
249
00:13:42,996 --> 00:13:44,270
and so now we can come back here
250
00:13:45,257 --> 00:13:47,557
and add some more styles here to really fit it
251
00:13:48,412 --> 00:13:50,112
to our specific needs in the form,
252
00:13:50,954 --> 00:13:53,877
or we could also give it here another class
253
00:13:53,877 --> 00:13:55,323
and style it again in the general.
254
00:13:56,221 --> 00:13:58,770
So for example, if we had another form somewhere else,
255
00:13:58,770 --> 00:14:01,250
we could then reuse that button there
256
00:14:02,794 --> 00:14:03,763
and actually let's do that.
257
00:14:05,520 --> 00:14:07,763
Let's call it button form.
258
00:14:09,522 --> 00:14:11,287
So we don't need this one
259
00:14:11,287 --> 00:14:13,210
and we don't even need the select one
260
00:14:14,271 --> 00:14:15,533
because it is already here.
261
00:14:18,241 --> 00:14:20,213
So let's do that after all these.
262
00:14:28,350 --> 00:14:29,183
So button form.
263
00:14:30,478 --> 00:14:32,795
And here, what I want to do is to use
264
00:14:32,795 --> 00:14:34,601
the exact same background color
265
00:14:34,601 --> 00:14:37,143
as we have here as the text color.
266
00:14:41,155 --> 00:14:42,517
So not that orange
267
00:14:42,517 --> 00:14:44,767
because that of course would become invisible
268
00:14:44,767 --> 00:14:46,623
on the already orange background color.
269
00:14:47,883 --> 00:14:49,283
So here we just use this one
270
00:14:50,840 --> 00:14:53,783
and think I haven't yet added that to our list.
271
00:14:56,211 --> 00:14:57,044
Nope, I did not.
272
00:15:03,946 --> 00:15:04,779
Okay.
273
00:15:08,672 --> 00:15:11,272
Then for the color to not contrast too much with it,
274
00:15:14,297 --> 00:15:15,643
because right now it's actually black,
275
00:15:16,637 --> 00:15:19,330
so we need to set it anyway, but let's not set it to white,
276
00:15:19,330 --> 00:15:21,903
but to this very light orange,
277
00:15:25,386 --> 00:15:27,786
and then we also need to now change the padding.
278
00:15:30,400 --> 00:15:32,112
Well, actually let's do that later
279
00:15:32,112 --> 00:15:33,103
and let's check it out now.
280
00:15:34,294 --> 00:15:35,927
So it looks like this.
281
00:15:35,927 --> 00:15:38,327
And why do you think that the button is so high?
282
00:15:39,464 --> 00:15:41,963
So basically that it is occupying all this space?
283
00:15:43,530 --> 00:15:46,370
Well, the reason is that this button is right now
284
00:15:47,314 --> 00:15:48,523
a grid item, right?
285
00:15:49,917 --> 00:15:52,660
And by default, grid items stretch to occupy
286
00:15:53,519 --> 00:15:54,533
the entire grid cell.
287
00:15:55,481 --> 00:15:57,151
Remember that?
288
00:15:57,151 --> 00:15:59,031
So that's important to know,
289
00:15:59,031 --> 00:16:01,443
because this is the reason why it looks this big.
290
00:16:02,661 --> 00:16:04,467
So let's try to fix that
291
00:16:04,467 --> 00:16:06,623
by vertically aligning it here to the end,
292
00:16:07,967 --> 00:16:10,710
because what I want to do is to give it the same size
293
00:16:10,710 --> 00:16:12,790
as this input field here
294
00:16:14,407 --> 00:16:16,793
and having it also aligned here to the bottom with it.
295
00:16:17,864 --> 00:16:20,314
So not to the top, but really with this one here.
296
00:16:22,042 --> 00:16:25,593
So let's try that with align self, so align self,
297
00:16:27,640 --> 00:16:29,500
because this is a grid item
298
00:16:30,961 --> 00:16:32,809
and to vertically align items,
299
00:16:32,809 --> 00:16:34,409
we use the align items property,
300
00:16:35,650 --> 00:16:38,080
but here we don't want to set that on the container,
301
00:16:38,080 --> 00:16:40,033
but simply on this button.
302
00:16:41,528 --> 00:16:42,673
And so that's why it's align self,
303
00:16:43,634 --> 00:16:45,483
just as we have learned many times before.
304
00:16:47,594 --> 00:16:50,423
So setting it to end should move it down there.
305
00:16:52,470 --> 00:16:53,616
Yeah.
306
00:16:53,616 --> 00:16:54,868
Nice.
307
00:16:54,868 --> 00:16:57,471
But it is still a bit bigger than this one
308
00:16:57,471 --> 00:16:59,871
because by default, the button has some padding.
309
00:17:02,715 --> 00:17:05,265
So the padding right now is coming from right here.
310
00:17:08,550 --> 00:17:10,203
So top and bottom, the padding is 1.6,
311
00:17:11,853 --> 00:17:13,103
but on the form elements.
312
00:17:14,517 --> 00:17:16,073
So on the inputs, it is only 1.2.
313
00:17:17,935 --> 00:17:19,533
And so if we set the padding to 1.2,
314
00:17:20,990 --> 00:17:23,363
this one should then have the exact same size.
315
00:17:26,848 --> 00:17:30,303
So let's do that here, padding 1.2 rem
316
00:17:33,463 --> 00:17:35,591
and the other side doesn't really matter
317
00:17:35,591 --> 00:17:37,563
because it will also stretch all the way.
318
00:17:38,631 --> 00:17:39,653
So let's just put it at 1.2,
319
00:17:41,935 --> 00:17:42,943
and there we go.
320
00:17:45,022 --> 00:17:47,829
So that looks a lot more natural, doesn't it?
321
00:17:47,829 --> 00:17:49,943
Having the exact same height as this one.
322
00:17:51,954 --> 00:17:54,764
So really, really nice, really beautiful.
323
00:17:54,764 --> 00:17:55,763
We're almost ready here.
324
00:17:56,618 --> 00:17:59,733
There's just one important thing or actually two or three.
325
00:18:01,209 --> 00:18:02,307
But what I just remembered,
326
00:18:02,307 --> 00:18:05,350
it is that we need to get rid of the fixed height
327
00:18:06,332 --> 00:18:07,603
that we set for this container.
328
00:18:09,105 --> 00:18:11,102
So way back in the first lecture,
329
00:18:11,102 --> 00:18:12,752
we set the height here to 50 rem.
330
00:18:14,802 --> 00:18:16,373
So we need to remove that now,
331
00:18:17,615 --> 00:18:20,600
because of course we want the content to dictate the height
332
00:18:21,440 --> 00:18:22,763
and not have it fixed.
333
00:18:25,971 --> 00:18:29,213
So remove all that and that is a lot better.
334
00:18:31,403 --> 00:18:34,909
So now the spacing here is the same all the way around
335
00:18:34,909 --> 00:18:35,742
this form element.
336
00:18:37,136 --> 00:18:41,053
Next up, let's take care of the hover state on this button.
337
00:18:46,979 --> 00:18:48,313
So that's button form.
338
00:18:52,014 --> 00:18:54,745
And here, let's actually change the background color
339
00:18:54,745 --> 00:18:55,578
to white.
340
00:18:57,939 --> 00:18:58,833
And then the color itself,
341
00:19:00,193 --> 00:19:02,290
let's make it the default color
342
00:19:02,290 --> 00:19:03,323
that we have been using all along.
343
00:19:04,302 --> 00:19:05,135
So 5, 5, 5.
344
00:19:06,568 --> 00:19:09,321
And the transition is not necessarily to define
345
00:19:09,321 --> 00:19:10,671
because it is already here,
346
00:19:12,105 --> 00:19:14,050
which the button is also part of.
347
00:19:14,050 --> 00:19:14,883
Right?
348
00:19:15,937 --> 00:19:18,963
And so this should be enough to make this effect work.
349
00:19:20,120 --> 00:19:23,483
Oh, and actually it did it, like permanently.
350
00:19:25,566 --> 00:19:27,790
So let's see what's happening here.
351
00:19:27,790 --> 00:19:29,550
So that's some kind of conflict
352
00:19:30,904 --> 00:19:33,091
between our selectors right now.
353
00:19:33,091 --> 00:19:36,113
Oh, actually we just forgot to write hover here.
354
00:19:37,680 --> 00:19:39,513
So no conflict after all.
355
00:19:42,990 --> 00:19:45,383
So now it should work just fine.
356
00:19:46,646 --> 00:19:48,100
And yes.
357
00:19:48,100 --> 00:19:48,933
Beautiful.
358
00:19:50,544 --> 00:19:52,933
So almost ready here, but just one final thing,
359
00:19:54,097 --> 00:19:55,997
which is these so-called focus states.
360
00:19:57,290 --> 00:19:59,940
So when I click here, you see that this gets focused.
361
00:20:00,895 --> 00:20:03,183
So that's this blue ring here around this form.
362
00:20:04,241 --> 00:20:05,074
And the same is true here.
363
00:20:06,444 --> 00:20:07,812
Well, not here.
364
00:20:07,812 --> 00:20:10,012
Well actually yes, at the same here as well.
365
00:20:13,301 --> 00:20:15,051
And actually it should also happen,
366
00:20:16,895 --> 00:20:19,897
well, actually not, because once we click them,
367
00:20:19,897 --> 00:20:21,903
we move back to the top of the page.
368
00:20:22,800 --> 00:20:25,763
But if on the keyboard we hit the tap button,
369
00:20:26,948 --> 00:20:28,948
then you see that they also get focused.
370
00:20:30,154 --> 00:20:32,915
And as I hit again, it moves to the next link.
371
00:20:32,915 --> 00:20:35,243
And then all of them get this blue border.
372
00:20:36,809 --> 00:20:38,634
And that's because of accessibility,
373
00:20:38,634 --> 00:20:40,472
because having this outline
374
00:20:40,472 --> 00:20:41,810
around the currently selected element
375
00:20:41,810 --> 00:20:45,670
makes it easy for users who can only use a keyboard
376
00:20:45,670 --> 00:20:47,083
to navigate the page.
377
00:20:48,717 --> 00:20:51,120
So now when I hit tap again, it will move to the next one,
378
00:20:51,120 --> 00:20:53,800
and then I know exactly which is the currently
379
00:20:54,702 --> 00:20:55,893
focused field, right?
380
00:20:57,816 --> 00:20:58,963
And the same also for the button.
381
00:21:00,180 --> 00:21:03,470
Now, many people think that this outline looks ugly
382
00:21:03,470 --> 00:21:06,900
and it is true that by default,
383
00:21:06,900 --> 00:21:08,643
the default one looks quite ugly.
384
00:21:10,096 --> 00:21:12,446
And so we can actually remove that default one,
385
00:21:13,459 --> 00:21:14,759
which is what in the past,
386
00:21:15,603 --> 00:21:16,923
basically everyone has been doing.
387
00:21:19,575 --> 00:21:22,275
So also here in our general, let's go here to the end.
388
00:21:25,671 --> 00:21:28,271
And so what we do is to select every single element.
389
00:21:29,132 --> 00:21:33,103
And then on the element, we can use the focus pseudo-class.
390
00:21:35,916 --> 00:21:38,823
So focus is a little bit like link or visited or hover.
391
00:21:40,024 --> 00:21:40,993
It's just another state.
392
00:21:41,998 --> 00:21:43,960
While in this case, it is just focus.
393
00:21:43,960 --> 00:21:45,545
And of course,
394
00:21:45,545 --> 00:21:48,360
we could define this year individually on links
395
00:21:49,216 --> 00:21:50,893
or on buttons or really anywhere.
396
00:21:52,144 --> 00:21:54,394
But when we want to set the same focus style,
397
00:21:55,657 --> 00:21:58,163
basically everywhere on the page, we just do it right here.
398
00:21:59,153 --> 00:22:01,624
So it's a little bit like the global reset,
399
00:22:01,624 --> 00:22:02,674
but for focus states.
400
00:22:04,265 --> 00:22:05,370
So that blue focus state
401
00:22:05,370 --> 00:22:09,850
that we see outside the input elements and links is
402
00:22:09,850 --> 00:22:12,523
because of a property called outline.
403
00:22:14,359 --> 00:22:16,603
So that's another new property.
404
00:22:16,603 --> 00:22:18,824
And this one is similar to a border,
405
00:22:18,824 --> 00:22:21,883
but it is basically more outside of the element,
406
00:22:22,967 --> 00:22:24,933
and it's also not part of the box model.
407
00:22:27,403 --> 00:22:29,627
So what many people have done in the past is
408
00:22:29,627 --> 00:22:31,773
set outline to none and call it a day.
409
00:22:33,217 --> 00:22:36,570
But that of course is an accessibility nightmare for people
410
00:22:36,570 --> 00:22:39,743
who rely on just using their keyboard.
411
00:22:42,068 --> 00:22:45,184
So you see that indeed the outline is gone now,
412
00:22:45,184 --> 00:22:47,125
but as they navigate the page
413
00:22:47,125 --> 00:22:49,724
by hitting the tab key on the keyboard,
414
00:22:49,724 --> 00:22:52,353
I don't really know where the focus state is right now.
415
00:22:53,302 --> 00:22:55,767
So I tapped it again, but where is it?
416
00:22:55,767 --> 00:22:57,017
Is it maybe here or here?
417
00:22:58,102 --> 00:23:01,193
And if I tap it again, well, it somehow goes back,
418
00:23:02,346 --> 00:23:04,900
but we don't really know where it is.
419
00:23:04,900 --> 00:23:07,823
So I keep tapping it, but where is the focus state?
420
00:23:08,720 --> 00:23:12,400
So that is really, really bad for accessibility.
421
00:23:12,400 --> 00:23:14,523
So please, never do this.
422
00:23:16,155 --> 00:23:17,955
So just setting the outline to none.
423
00:23:19,711 --> 00:23:20,681
So instead,
424
00:23:20,681 --> 00:23:24,090
what we can do is to still leave the outline at none,
425
00:23:24,090 --> 00:23:28,400
but then show the user some other kind of focus indicator
426
00:23:28,400 --> 00:23:29,813
that looks a bit nicer.
427
00:23:31,034 --> 00:23:32,484
So one that we actually like.
428
00:23:33,862 --> 00:23:35,590
Now there are multiple ways of doing that.
429
00:23:35,590 --> 00:23:39,023
So we can actually still use the outline property,
430
00:23:40,710 --> 00:23:42,593
for example, a dotted border,
431
00:23:44,113 --> 00:23:46,943
because we can style outline just like we can style border.
432
00:23:47,913 --> 00:23:49,333
So we can say four pixel dotted.
433
00:23:51,183 --> 00:23:52,423
And then this one here,
434
00:23:53,709 --> 00:23:55,493
and then we can even define an offset.
435
00:24:01,860 --> 00:24:02,833
Let's say eight pixels.
436
00:24:03,856 --> 00:24:05,433
Okay?
437
00:24:05,433 --> 00:24:07,073
So let's see what happens then with the focus states.
438
00:24:08,301 --> 00:24:09,213
And so that looks like this.
439
00:24:11,623 --> 00:24:12,635
So you see?
440
00:24:12,635 --> 00:24:15,106
Now it's here, then I hit tap again.
441
00:24:15,106 --> 00:24:17,553
And so it keeps moving from one link to the other one.
442
00:24:19,014 --> 00:24:21,223
So that's the four pixels dotted.
443
00:24:22,321 --> 00:24:25,020
And then with the outline offset of eight pixels.
444
00:24:25,020 --> 00:24:27,163
However, what I don't like about this,
445
00:24:28,198 --> 00:24:30,540
is that it doesn't wrap around here,
446
00:24:30,540 --> 00:24:32,433
the rounded borders of the elements.
447
00:24:33,953 --> 00:24:34,978
You see that?
448
00:24:34,978 --> 00:24:36,663
So it's basically still just a square.
449
00:24:37,565 --> 00:24:40,696
And here, that's not a problem, but then here again,
450
00:24:40,696 --> 00:24:41,529
it doesn't look so nice.
451
00:24:42,552 --> 00:24:44,802
And so there's actually an even better trick,
452
00:24:45,729 --> 00:24:47,763
which is using a box shadow.
453
00:24:49,464 --> 00:24:52,273
So let's turn this one off and this one off,
454
00:24:55,660 --> 00:24:58,333
and instead use a box shadow trick here.
455
00:24:59,679 --> 00:25:02,280
So this trick is going to be similar to what we did before
456
00:25:02,280 --> 00:25:05,963
with this outline button here.
457
00:25:07,681 --> 00:25:10,343
So remember, here, we used it to add a border inside.
458
00:25:11,707 --> 00:25:13,477
So we set everything to zero
459
00:25:13,477 --> 00:25:17,423
and then just set here the blur or the spread to something.
460
00:25:18,816 --> 00:25:20,525
So here we're going to do the same,
461
00:25:20,525 --> 00:25:21,875
but without it being inset.
462
00:25:23,710 --> 00:25:26,573
So I was still outside of the element, not inside,
463
00:25:28,200 --> 00:25:31,683
but still, it's going to be zero in all directions.
464
00:25:32,763 --> 00:25:35,163
Also, no spread, but just scale it a little bit.
465
00:25:36,290 --> 00:25:37,693
Let's say also by eight pixels.
466
00:25:39,921 --> 00:25:40,754
So 0.8 rem.
467
00:25:41,829 --> 00:25:42,723
And then as for the color,
468
00:25:43,969 --> 00:25:45,619
let's actually try also this one,
469
00:25:47,532 --> 00:25:49,182
but maybe with some transparency.
470
00:25:50,730 --> 00:25:53,914
So I click here the top and usually it should be black.
471
00:25:53,914 --> 00:25:54,980
There should be some black text
472
00:25:57,244 --> 00:26:01,133
and now let's set it to like 50%.
473
00:26:02,325 --> 00:26:05,275
And so you will see that this is going to look a lot nicer.
474
00:26:06,882 --> 00:26:08,465
So you'll see that?
475
00:26:09,787 --> 00:26:12,258
Now here it's actually quite invisible,
476
00:26:12,258 --> 00:26:14,908
so we will have to fix that so you can barely see it.
477
00:26:16,814 --> 00:26:19,341
But now here, it is actually quite visible.
478
00:26:19,341 --> 00:26:21,451
And this looks a lot nicer
479
00:26:21,451 --> 00:26:23,551
because it does wrap around these corners,
480
00:26:24,966 --> 00:26:27,603
because in the end it is really just a box shadow.
481
00:26:30,398 --> 00:26:32,378
Now, down here in the form,
482
00:26:32,378 --> 00:26:35,373
we will have to change it for example, to a white color.
483
00:26:37,926 --> 00:26:38,776
So let's do that.
484
00:26:39,862 --> 00:26:40,890
So I'll just copy this code
485
00:26:42,012 --> 00:26:45,573
and go here and to define that here, by the very end.
486
00:26:48,167 --> 00:26:49,217
So inside of the CTA,
487
00:26:51,586 --> 00:26:53,769
I can then still select everything
488
00:26:53,769 --> 00:26:55,403
and to make the focus a bit different.
489
00:26:57,018 --> 00:26:57,851
So this we don't need
490
00:27:01,027 --> 00:27:06,027
and let's use our very, very light orange.
491
00:27:09,106 --> 00:27:11,433
So that is, well, it's this one here.
492
00:27:12,957 --> 00:27:13,790
Somehow it wasn't on the list,
493
00:27:16,341 --> 00:27:19,191
but of course we still need to give it some transparency.
494
00:27:23,105 --> 00:27:26,423
And let's again, try a 50%.
495
00:27:27,884 --> 00:27:29,403
And so we're almost done here.
496
00:27:30,790 --> 00:27:33,594
So you might think that this is a small detail
497
00:27:33,594 --> 00:27:35,215
that we should not worry about,
498
00:27:35,215 --> 00:27:38,306
but actually accessibility is really important.
499
00:27:38,306 --> 00:27:40,140
So these focus styles are really something
500
00:27:40,140 --> 00:27:42,940
that you must define in your own page.
501
00:27:42,940 --> 00:27:43,963
Unless of course,
502
00:27:44,996 --> 00:27:47,763
you want to keep those ugly looking blue outlines.
503
00:27:49,024 --> 00:27:50,374
But those one I don't like,
504
00:27:51,246 --> 00:27:53,450
and most people don't like them as well.
505
00:27:53,450 --> 00:27:54,633
So we just do something like this.
506
00:27:56,698 --> 00:27:59,633
And so now, this is a beautiful outline here.
507
00:28:00,670 --> 00:28:03,560
And it makes the focus state really visible
508
00:28:03,560 --> 00:28:06,380
and helps the user know where they are right now
509
00:28:06,380 --> 00:28:08,070
on the page.
510
00:28:08,070 --> 00:28:08,903
All right.
511
00:28:08,903 --> 00:28:10,053
And that's it.
512
00:28:11,335 --> 00:28:13,975
That's all I had to show you for forms
513
00:28:13,975 --> 00:28:15,933
and for formatting them.
514
00:28:15,933 --> 00:28:18,822
Now, there is a lot more things that we can do
515
00:28:18,822 --> 00:28:21,596
and that at some point you might have to learn.
516
00:28:21,596 --> 00:28:23,820
For example, how to format check boxes,
517
00:28:23,820 --> 00:28:25,743
which are quite common as well,
518
00:28:26,982 --> 00:28:29,855
but that is a bit outside of the scope of this course,
519
00:28:29,855 --> 00:28:32,342
because data is actually a bit tricky.
520
00:28:32,342 --> 00:28:34,523
Check boxes are very hard to style.
521
00:28:35,550 --> 00:28:37,148
And so, yeah,
522
00:28:37,148 --> 00:28:39,948
I'm leaving that for another time, let's say now, right?
523
00:28:41,440 --> 00:28:43,380
So this is the basics that you need to know
524
00:28:43,380 --> 00:28:46,209
to get started with building your own forms.
525
00:28:46,209 --> 00:28:47,042
And so hopefully,
526
00:28:47,042 --> 00:28:48,400
all of this made sense to you
527
00:28:48,400 --> 00:28:51,483
so that now you can start doing just that.
528
00:28:53,085 --> 00:28:54,221
Awesome.
529
00:28:54,221 --> 00:28:55,286
So with this,
530
00:28:55,286 --> 00:28:57,794
we are almost finished with our project.
531
00:28:57,794 --> 00:29:00,100
All that is left to do is to build the footer.
532
00:29:00,100 --> 00:29:03,093
So this will be the last part of the section.
533
00:29:04,552 --> 00:29:07,337
And so if you're ready for that, let's go there now.
38784
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.