All language subtitles for 056 Adding Flexbox to Our Project.en_US

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,440 --> 00:00:03,600 Now that you know about the fundamentals 2 00:00:03,600 --> 00:00:07,620 of Flexbox, let's finally start adding Flexbox 3 00:00:07,620 --> 00:00:10,093 to our Blockpost project. 4 00:00:11,570 --> 00:00:12,710 Okay. 5 00:00:12,710 --> 00:00:16,230 So let's go back here to our project 6 00:00:19,330 --> 00:00:21,640 and give it a better width. 7 00:00:21,640 --> 00:00:26,290 And so this is the layout that we built before using floats. 8 00:00:26,290 --> 00:00:29,610 And we also did a lot of other stuff using floats, 9 00:00:29,610 --> 00:00:33,520 like putting this text here, side by side with the image, 10 00:00:33,520 --> 00:00:37,590 and also here putting this navigation on the right side 11 00:00:37,590 --> 00:00:39,937 and the heading on the left side. 12 00:00:39,937 --> 00:00:42,040 And so, let's now go ahead 13 00:00:42,040 --> 00:00:46,011 and disable all of this so that we can now 14 00:00:46,011 --> 00:00:50,763 do the same thing, but using Flexbox. 15 00:00:52,070 --> 00:00:53,420 Okay. 16 00:00:53,420 --> 00:00:56,880 So now we are back to what it looked like before using 17 00:00:56,880 --> 00:00:58,090 floats. 18 00:00:58,090 --> 00:01:01,693 And so again, let's now fix this once again. 19 00:01:03,490 --> 00:01:04,323 Okay. 20 00:01:04,323 --> 00:01:07,060 And we'll start here with the navigation at the heading. 21 00:01:07,060 --> 00:01:09,723 So putting these once again, side by side. 22 00:01:11,200 --> 00:01:15,590 So the way we did it before was to float both the H1 23 00:01:15,590 --> 00:01:20,200 and the number, but now of course we will use Flexbox. 24 00:01:20,200 --> 00:01:23,900 And so where do we actually need to use Flexbox 25 00:01:23,900 --> 00:01:25,270 or in other words, 26 00:01:25,270 --> 00:01:29,120 what element should be the flex container here? 27 00:01:29,120 --> 00:01:31,310 Well, it needs to be the element 28 00:01:31,310 --> 00:01:34,860 that is the parent of both of these. 29 00:01:34,860 --> 00:01:36,100 Right? 30 00:01:36,100 --> 00:01:38,683 And so that is the main header. 31 00:01:41,213 --> 00:01:46,187 So the element, which has this main header class, right? 32 00:01:48,070 --> 00:01:51,180 So just to make sure let's quickly check that out 33 00:01:51,180 --> 00:01:54,600 in the mark up here. 34 00:01:54,600 --> 00:01:59,410 And so indeed the main header is the parent of both the H1 35 00:01:59,410 --> 00:02:00,283 and the NEF. 36 00:02:02,220 --> 00:02:03,400 All right. 37 00:02:03,400 --> 00:02:05,220 And so let's make this, 38 00:02:05,220 --> 00:02:09,523 the flex container by setting display to flex. 39 00:02:10,790 --> 00:02:14,320 So this will already put them side by side. 40 00:02:14,320 --> 00:02:17,243 And so now let's fix here the vertical alignment. 41 00:02:18,910 --> 00:02:21,323 Now, there's just one thing that we need to do. 42 00:02:22,640 --> 00:02:24,890 So you'll see that all of these links here, 43 00:02:24,890 --> 00:02:28,720 they have a margin to the top of 10 pixels. 44 00:02:28,720 --> 00:02:30,430 So this one here. 45 00:02:30,430 --> 00:02:34,210 And so we want to remove that now and we actually want to 46 00:02:34,210 --> 00:02:36,550 remove that forever. 47 00:02:36,550 --> 00:02:40,683 So let's do that, not here, which is for the Flexbox part, 48 00:02:41,830 --> 00:02:46,830 but let's do it up there where we actually defined that. 49 00:02:48,920 --> 00:02:53,100 So you see that our CSS is growing bigger. 50 00:02:53,100 --> 00:02:55,780 And so it's getting harder to find the code 51 00:02:55,780 --> 00:02:57,180 that we're looking for. 52 00:02:57,180 --> 00:02:58,490 And so in a bigger project, 53 00:02:58,490 --> 00:03:01,300 we will of course find a way of organizing this 54 00:03:01,300 --> 00:03:02,313 a little bit better. 55 00:03:04,480 --> 00:03:09,480 So removing this and you see that it moved up now, 56 00:03:10,020 --> 00:03:14,560 but again, we now want these two to be vertically aligned. 57 00:03:14,560 --> 00:03:16,923 And do you remember how we do that? 58 00:03:17,790 --> 00:03:22,790 Well, we just use align items, 59 00:03:23,390 --> 00:03:26,693 which by default aligns items vertically. 60 00:03:27,720 --> 00:03:32,640 And so if we say center then automatically they move here 61 00:03:32,640 --> 00:03:33,843 to the center. 62 00:03:34,760 --> 00:03:35,780 So that's great. 63 00:03:35,780 --> 00:03:36,880 Very easy. 64 00:03:36,880 --> 00:03:41,880 There is no way to manually add some padding or some margin 65 00:03:41,940 --> 00:03:43,950 until it is centered. 66 00:03:43,950 --> 00:03:46,090 So in this way it happens automatically, 67 00:03:46,090 --> 00:03:48,290 which is a lot better. 68 00:03:48,290 --> 00:03:52,010 And now the next thing that we want to do is to basically 69 00:03:52,010 --> 00:03:55,020 push this one here to the right side. 70 00:03:55,020 --> 00:03:57,220 So this entire navigation. 71 00:03:57,220 --> 00:04:01,060 So whenever we have just two flex items and we want to push 72 00:04:01,060 --> 00:04:03,290 each of them to one side, 73 00:04:03,290 --> 00:04:07,683 then the perfect thing to do is to use justify content. 74 00:04:08,538 --> 00:04:13,538 So remember justify content is similar to align items, 75 00:04:14,190 --> 00:04:18,023 but this one is to align items basically horizontally 76 00:04:18,023 --> 00:04:19,980 by default. 77 00:04:19,980 --> 00:04:24,690 So remember that we could set it to center as well, 78 00:04:24,690 --> 00:04:26,563 which would then look like this. 79 00:04:27,440 --> 00:04:31,650 So now these two are in the very center of the header, 80 00:04:31,650 --> 00:04:34,993 but what we want is actually space between. 81 00:04:37,337 --> 00:04:41,330 And so this will basically take all the empty space 82 00:04:41,330 --> 00:04:44,430 and divide that as a space between them. 83 00:04:44,430 --> 00:04:47,310 And in case we only have two elements. 84 00:04:47,310 --> 00:04:50,650 Then that means that all the remaining space will stay 85 00:04:50,650 --> 00:04:53,710 between the both of the flex items. 86 00:04:53,710 --> 00:04:55,950 And so as a consequence of that, 87 00:04:55,950 --> 00:04:59,230 each of them gets pushed to one of the sides. 88 00:04:59,230 --> 00:05:00,100 Nice. 89 00:05:00,100 --> 00:05:02,290 So this one is fixed. 90 00:05:02,290 --> 00:05:07,040 So let's move on to the next one, which is this part here. 91 00:05:07,040 --> 00:05:11,157 So we want this text here to be back side by side 92 00:05:11,157 --> 00:05:13,950 with the image, right? 93 00:05:13,950 --> 00:05:15,130 So once again, 94 00:05:15,130 --> 00:05:19,160 let's ask ourselves what should be the flex container 95 00:05:19,160 --> 00:05:20,270 or in other words, 96 00:05:20,270 --> 00:05:23,350 what parent element of these two elements here 97 00:05:23,350 --> 00:05:26,840 makes sense to become the flex container? 98 00:05:26,840 --> 00:05:31,840 Well, let's check out our HTML, I'd like to do that now, 99 00:05:31,880 --> 00:05:34,440 right here in the inspector. 100 00:05:34,440 --> 00:05:35,960 So in the dev tools, 101 00:05:35,960 --> 00:05:39,621 and I think it's a bit too small again, 102 00:05:39,621 --> 00:05:41,463 let's make it bigger. 103 00:05:42,650 --> 00:05:46,240 And so these two are the elements that we are interested in. 104 00:05:46,240 --> 00:05:49,340 So image and P however, 105 00:05:49,340 --> 00:05:53,723 the flex container should not really be this one, right? 106 00:05:54,690 --> 00:05:58,770 I mean, it is the parent of image and a paragraph, 107 00:05:58,770 --> 00:06:01,510 but also of all these other elements. 108 00:06:01,510 --> 00:06:04,440 So that's not really going to work, is it? 109 00:06:04,440 --> 00:06:09,003 Let's actually try it out, post, header, 110 00:06:09,862 --> 00:06:14,862 and set display to flex, but that should look very weird. 111 00:06:17,610 --> 00:06:21,670 And indeed it does because now this here is the flex 112 00:06:21,670 --> 00:06:24,640 container and all of these are flex elements, 113 00:06:24,640 --> 00:06:29,023 which are now placed side by side, at least if possible. 114 00:06:29,860 --> 00:06:32,350 And so of course this is not what we want. 115 00:06:32,350 --> 00:06:35,250 And so the solution is to create a new element, 116 00:06:35,250 --> 00:06:38,190 which will be the parent of the image 117 00:06:38,190 --> 00:06:39,563 and this paragraph. 118 00:06:41,170 --> 00:06:42,560 All right. 119 00:06:42,560 --> 00:06:46,620 So that can just be a simple div because we don't need any 120 00:06:46,620 --> 00:06:47,823 meaning for that. 121 00:06:50,960 --> 00:06:53,763 So let's call this the author box. 122 00:06:55,250 --> 00:06:58,920 And now let me use that trick where I hit the option or alt 123 00:06:58,920 --> 00:07:02,586 key to get her with the arrow down key 124 00:07:02,586 --> 00:07:05,650 to move down this div element. 125 00:07:05,650 --> 00:07:07,400 So this closing tag, 126 00:07:07,400 --> 00:07:11,120 and so this is an easy way of wrapping two elements 127 00:07:11,120 --> 00:07:12,973 inside of a new parent element. 128 00:07:14,460 --> 00:07:17,330 So this is the class author box, 129 00:07:17,330 --> 00:07:19,610 which should now become the flex container 130 00:07:19,610 --> 00:07:21,623 instead of post header. 131 00:07:23,420 --> 00:07:24,970 Let's see. 132 00:07:24,970 --> 00:07:27,353 And immediately they are side by side. 133 00:07:28,560 --> 00:07:30,170 So that's beautiful. 134 00:07:30,170 --> 00:07:32,715 Now, all we need to do is to once again, 135 00:07:32,715 --> 00:07:34,850 vertically center them. 136 00:07:34,850 --> 00:07:37,890 And then we could also add some space here to the image, 137 00:07:37,890 --> 00:07:41,803 maybe to give ourselves some space here between these two. 138 00:07:43,420 --> 00:07:45,570 So once again, 139 00:07:45,570 --> 00:07:50,570 we are going to use align items and set to center. 140 00:07:53,150 --> 00:07:54,163 All right. 141 00:07:55,930 --> 00:07:58,800 Well, that actually looks a bit strange, 142 00:07:58,800 --> 00:08:00,200 so it's not really centered. 143 00:08:01,050 --> 00:08:04,520 And I think that's because there is some margin happening. 144 00:08:04,520 --> 00:08:06,600 Yes, that's right. 145 00:08:06,600 --> 00:08:08,350 And so in this situation, 146 00:08:08,350 --> 00:08:12,140 the margin is then kind of part of the element when it comes 147 00:08:12,140 --> 00:08:14,080 to vertical centering. 148 00:08:14,080 --> 00:08:15,630 All right. 149 00:08:15,630 --> 00:08:18,700 So let's actually remove that margin 150 00:08:18,700 --> 00:08:21,113 because it doesn't make much sense. 151 00:08:22,740 --> 00:08:23,573 Then here, 152 00:08:23,573 --> 00:08:26,620 I thought that this image actually had some margin 153 00:08:26,620 --> 00:08:30,683 to the bottom, but maybe it does not. 154 00:08:31,804 --> 00:08:32,810 Okay. 155 00:08:32,810 --> 00:08:33,643 But anyway, 156 00:08:33,643 --> 00:08:37,120 what we want to do is to permanently remove the margin 157 00:08:37,120 --> 00:08:38,940 bottom from this one. 158 00:08:38,940 --> 00:08:41,300 So let's select simply the author here 159 00:08:41,300 --> 00:08:43,830 and then let's override that. 160 00:08:43,830 --> 00:08:46,243 So basically set it back to zero. 161 00:08:47,280 --> 00:08:48,113 Okay. 162 00:08:50,150 --> 00:08:54,640 So we have not selected this author class before, 163 00:08:54,640 --> 00:08:56,163 so let's do that here. 164 00:08:57,790 --> 00:09:02,210 So the margin at the bottom should be zero, 165 00:09:02,210 --> 00:09:05,580 and then let's actually add a margin to the left here 166 00:09:05,580 --> 00:09:07,000 to create that space between 167 00:09:07,000 --> 00:09:12,000 the image, margin left 15 pixels. 168 00:09:13,350 --> 00:09:16,470 And here we go. 169 00:09:16,470 --> 00:09:17,550 Nice. 170 00:09:17,550 --> 00:09:21,310 Now let's just add some space between this new author box 171 00:09:21,310 --> 00:09:24,380 that we created and this element here, 172 00:09:24,380 --> 00:09:29,150 so I'm adding another margin left of 15 pixels or actually 173 00:09:29,150 --> 00:09:31,593 margin bottom, of course. 174 00:09:35,680 --> 00:09:38,290 Okay, beautiful. 175 00:09:38,290 --> 00:09:42,860 And now it's actually finally time to style this one here 176 00:09:42,860 --> 00:09:44,680 a little bit better. 177 00:09:44,680 --> 00:09:47,570 So each of these LI elements here 178 00:09:47,570 --> 00:09:51,010 are kind of a mess right now. 179 00:09:51,010 --> 00:09:54,470 Let's actually check out the markup and we can do that here 180 00:09:54,470 --> 00:09:57,630 again right here. 181 00:09:57,630 --> 00:10:02,530 So we have DLIS and all it does is to have an image 182 00:10:02,530 --> 00:10:05,500 and the A and the P in there. 183 00:10:05,500 --> 00:10:09,070 But what we really want is to have this anchor and this 184 00:10:09,070 --> 00:10:12,303 paragraph side by side with the image. 185 00:10:13,900 --> 00:10:15,540 So let me see. 186 00:10:15,540 --> 00:10:16,373 Yeah. 187 00:10:16,373 --> 00:10:18,500 So this here is what we want. 188 00:10:18,500 --> 00:10:22,210 So on one side image, and on the other side, some bugs, 189 00:10:22,210 --> 00:10:26,020 which then contains these two elements right here. 190 00:10:26,020 --> 00:10:30,830 So let's add some classes here to our markup, 191 00:10:30,830 --> 00:10:33,113 so we can actually style it now, finally, 192 00:10:34,700 --> 00:10:37,740 so this entire UL is called related. 193 00:10:37,740 --> 00:10:42,740 So let's give each of the LIS a class of related posts. 194 00:10:48,920 --> 00:10:51,140 So copying all of this, 195 00:10:51,140 --> 00:10:55,120 and ideally we add these classes right in the beginning when 196 00:10:55,120 --> 00:10:57,700 we actually start writing our markup. 197 00:10:57,700 --> 00:10:58,670 All right. 198 00:10:58,670 --> 00:11:03,021 So we don't just do it later because that is a bit more work 199 00:11:03,021 --> 00:11:06,690 because now we actually also should add some classes 200 00:11:06,690 --> 00:11:08,463 here to these hyperlinks. 201 00:11:09,330 --> 00:11:12,010 So the piece already have related author. 202 00:11:12,010 --> 00:11:15,193 So let's call this one here, the related link. 203 00:11:17,020 --> 00:11:21,113 So class related link. 204 00:11:23,670 --> 00:11:26,593 And then add that to the other two. 205 00:11:30,640 --> 00:11:32,363 And there we go. 206 00:11:34,190 --> 00:11:36,400 Now, going back here to our CSS, 207 00:11:36,400 --> 00:11:41,178 the flex container should probably be the related posts, 208 00:11:41,178 --> 00:11:42,413 right? 209 00:11:43,510 --> 00:11:47,890 So related posts and set display to flex. 210 00:11:51,160 --> 00:11:52,803 And this is the one, 211 00:11:53,770 --> 00:11:57,480 but now we have the problem where all of the three are now 212 00:11:57,480 --> 00:11:58,563 flex items. 213 00:12:00,300 --> 00:12:02,620 So you'll see this one and this one, 214 00:12:02,620 --> 00:12:05,570 and this one are all flex items, 215 00:12:05,570 --> 00:12:07,950 and that is not what we want. 216 00:12:07,950 --> 00:12:11,820 So I think I mentioned it earlier that we want these two 217 00:12:11,820 --> 00:12:14,390 here to be in the same box, 218 00:12:14,390 --> 00:12:18,323 so that that box can be on the right side of the image. 219 00:12:20,300 --> 00:12:22,910 So I forgot to do that here. 220 00:12:22,910 --> 00:12:24,163 So let's do it now. 221 00:12:25,030 --> 00:12:28,830 So I'm just, again, wrapping it inside of a div. 222 00:12:28,830 --> 00:12:30,740 Then here I hit enter. 223 00:12:30,740 --> 00:12:31,573 And again, 224 00:12:31,573 --> 00:12:34,770 I use option and arrow down to move it down 225 00:12:34,770 --> 00:12:36,013 and give it a save. 226 00:12:37,270 --> 00:12:39,960 And this one here doesn't really need any name. 227 00:12:39,960 --> 00:12:41,720 We really just need this box. 228 00:12:41,720 --> 00:12:44,520 So that this box with this content 229 00:12:44,520 --> 00:12:47,583 can then be at the right side of this image. 230 00:12:52,410 --> 00:12:55,203 So again, the trick of moving down this div, 231 00:12:56,090 --> 00:13:00,323 so that closing tag and here are the same. 232 00:13:01,300 --> 00:13:04,993 Well, I should at least spell it right, like this. 233 00:13:06,520 --> 00:13:08,530 And if we check it out now, 234 00:13:08,530 --> 00:13:10,773 then that finally looks right. 235 00:13:12,530 --> 00:13:13,890 Okay. 236 00:13:13,890 --> 00:13:17,668 And now we then need to also vertically align 237 00:13:17,668 --> 00:13:19,930 this once again, 238 00:13:19,930 --> 00:13:24,930 let's actually make this smaller again so we can immediately 239 00:13:25,160 --> 00:13:26,333 see our results. 240 00:13:27,690 --> 00:13:31,400 So at this point it should be easy to vertically align them, 241 00:13:31,400 --> 00:13:32,680 right? 242 00:13:32,680 --> 00:13:37,123 So align items center. 243 00:13:39,940 --> 00:13:41,690 All right, nice. 244 00:13:41,690 --> 00:13:44,040 But now once again, there is this problem 245 00:13:44,040 --> 00:13:45,360 that one of these elements, 246 00:13:45,360 --> 00:13:48,013 I guess, still has an old margin. 247 00:13:49,170 --> 00:13:52,660 So that is a problem that happens when we start writing code 248 00:13:52,660 --> 00:13:54,778 first with floats, for example, 249 00:13:54,778 --> 00:13:58,110 or just adding some random margins everywhere. 250 00:13:58,110 --> 00:14:01,800 And only later we start refining the code. 251 00:14:01,800 --> 00:14:04,480 So that's happening because we're still learning here, 252 00:14:04,480 --> 00:14:08,100 but in the future, all of this will become a bit easier. 253 00:14:08,100 --> 00:14:11,390 So don't worry that this is all a mess. 254 00:14:11,390 --> 00:14:15,160 So in this case, we still have this problem that by default, 255 00:14:15,160 --> 00:14:18,313 we assigned a margin bottom to the paragraphs. 256 00:14:19,260 --> 00:14:23,093 So let's get this related author here and remove that. 257 00:14:24,880 --> 00:14:26,973 So related author. 258 00:14:28,140 --> 00:14:33,140 And then let's say margin bottom and put it back to zero. 259 00:14:35,350 --> 00:14:36,370 And since we're here, 260 00:14:36,370 --> 00:14:41,370 let's actually also style this sort of font size 14 pixels. 261 00:14:43,590 --> 00:14:46,530 And many of the things that we need to do here is to now 262 00:14:46,530 --> 00:14:50,460 kind of reset some of the things we did earlier. 263 00:14:50,460 --> 00:14:53,070 So for example, for some reason, this is bold. 264 00:14:53,070 --> 00:14:54,883 So let's put it back to normal. 265 00:14:55,770 --> 00:14:59,223 So font weight should be normal. 266 00:15:00,270 --> 00:15:05,093 And now let's actually style all of these as italic, 267 00:15:08,760 --> 00:15:11,950 and let's wait for it. 268 00:15:11,950 --> 00:15:12,783 Yeah. 269 00:15:12,783 --> 00:15:14,750 That looks quite nice already. 270 00:15:14,750 --> 00:15:18,010 Let's quickly now style these links here, actually. 271 00:15:18,010 --> 00:15:20,050 And then once we're done with that, 272 00:15:20,050 --> 00:15:21,683 we will add some spacing here. 273 00:15:23,070 --> 00:15:25,803 So let's do that here. 274 00:15:28,580 --> 00:15:33,070 So related link, 275 00:15:33,070 --> 00:15:35,980 and then never forget that we need to use 276 00:15:35,980 --> 00:15:38,400 the link pseudo class. 277 00:15:38,400 --> 00:15:39,253 All right. 278 00:15:40,850 --> 00:15:45,323 So let's say font size, 17 pixels, 279 00:15:47,090 --> 00:15:50,640 there is a small bug, then here, 280 00:15:50,640 --> 00:15:53,353 the font weight should be bold, 281 00:15:54,580 --> 00:15:57,793 but the font style should been normal. 282 00:16:01,320 --> 00:16:04,220 So again, in the very beginning of the course, 283 00:16:04,220 --> 00:16:07,920 we wrote some style that made it so that this very first 284 00:16:07,920 --> 00:16:09,290 element is bold. 285 00:16:09,290 --> 00:16:12,960 And the last one is italic. 286 00:16:12,960 --> 00:16:16,470 And so here we are just resetting that instead of going back 287 00:16:16,470 --> 00:16:18,643 all the way and fixing that code. 288 00:16:20,220 --> 00:16:21,810 Okay. 289 00:16:21,810 --> 00:16:23,450 So that looks a bit better. 290 00:16:23,450 --> 00:16:25,150 Let's just add some margin here 291 00:16:25,150 --> 00:16:26,943 to the bottom of this anchor. 292 00:16:28,710 --> 00:16:32,740 So margin bottom, let's say five pixels. 293 00:16:32,740 --> 00:16:36,430 And this is once again, just to show you something, 294 00:16:36,430 --> 00:16:39,550 because this actually did not work. 295 00:16:39,550 --> 00:16:41,720 So it looks exactly the same. 296 00:16:41,720 --> 00:16:44,113 And can you guess why that is happening? 297 00:16:45,050 --> 00:16:45,883 Well, 298 00:16:45,883 --> 00:16:50,050 the reason is that the anchor remember is an inline element 299 00:16:50,050 --> 00:16:54,044 and therefore vertical spacing like margin bottom 300 00:16:54,044 --> 00:16:56,903 and margin top do not apply. 301 00:16:58,050 --> 00:16:59,490 So to fix that, 302 00:16:59,490 --> 00:17:03,650 let's simply display it as a block and then this keeps 303 00:17:03,650 --> 00:17:05,850 jumping up. 304 00:17:05,850 --> 00:17:10,850 But anyway, now we get our nice spacing, right? 305 00:17:11,120 --> 00:17:15,570 And now just to finish, let's add that gap here, 306 00:17:15,570 --> 00:17:17,040 so that spacing. 307 00:17:17,040 --> 00:17:18,960 So how could we do that? 308 00:17:18,960 --> 00:17:23,220 Well, there are three different ways actually. 309 00:17:23,220 --> 00:17:25,670 So we could select this image here, 310 00:17:25,670 --> 00:17:29,980 then at some space to the right, we could select this box, 311 00:17:29,980 --> 00:17:31,913 which contains these two. 312 00:17:31,913 --> 00:17:36,420 So this div here and then add some space to the left, 313 00:17:36,420 --> 00:17:39,950 or we could use that other property on the flex container 314 00:17:39,950 --> 00:17:41,410 that I showed you earlier, 315 00:17:41,410 --> 00:17:43,720 which is the gap property 316 00:17:43,720 --> 00:17:47,440 and that is personally my absolute favorite. 317 00:17:47,440 --> 00:17:49,523 And so let's do that. 318 00:17:51,870 --> 00:17:54,060 So the related posts here, 319 00:17:54,060 --> 00:17:57,498 remember it's the flex container and we can easily see that 320 00:17:57,498 --> 00:18:01,742 because that's the one who has display set to flex. 321 00:18:01,742 --> 00:18:04,890 And then let's add a gap of 20 pixels 322 00:18:06,440 --> 00:18:10,362 and nice, there it is. 323 00:18:10,362 --> 00:18:14,450 The only problem with the gap property in Flexbox is 324 00:18:14,450 --> 00:18:17,700 that only the very latest versions of Safari 325 00:18:17,700 --> 00:18:19,130 actually support it. 326 00:18:19,130 --> 00:18:23,640 So on the Mac and on Safari until a couple of weeks ago, 327 00:18:23,640 --> 00:18:27,850 gap was actually not supported, but now it is. 328 00:18:27,850 --> 00:18:31,150 And so we can maybe start using it, 329 00:18:31,150 --> 00:18:35,400 especially if you are watching this in the far future. 330 00:18:35,400 --> 00:18:36,233 Anyway, 331 00:18:36,233 --> 00:18:40,327 let's now also add some margin here to the bottom 332 00:18:40,327 --> 00:18:43,650 of 30 pixels to add some space 333 00:18:43,650 --> 00:18:46,470 between these and we also then 334 00:18:46,470 --> 00:18:49,003 need to remove it from the last one. 335 00:18:50,140 --> 00:18:52,923 So as usual, all of them get this, 336 00:18:54,371 --> 00:18:56,710 well, actually it doesn't. 337 00:18:56,710 --> 00:19:00,810 So this has the margin bottom, this and this doesn't. 338 00:19:00,810 --> 00:19:04,393 So I guess we already wrote some style which did this. 339 00:19:05,980 --> 00:19:09,220 So indeed we somewhere selected all the list elements, 340 00:19:09,220 --> 00:19:12,763 and then the last child, we set margin bottom to zero. 341 00:19:14,120 --> 00:19:14,953 All right. 342 00:19:14,953 --> 00:19:17,410 And so that fixed it then for us here in this situation 343 00:19:17,410 --> 00:19:18,243 as well. 344 00:19:20,120 --> 00:19:21,090 Okay. 345 00:19:21,090 --> 00:19:22,310 And actually, 346 00:19:22,310 --> 00:19:25,980 I think that's it for transforming the smaller parts 347 00:19:25,980 --> 00:19:28,960 of the page to Flexbox. 348 00:19:28,960 --> 00:19:33,150 So Flexbox is absolutely perfect for these small component 349 00:19:33,150 --> 00:19:35,890 layouts that we just built here. 350 00:19:35,890 --> 00:19:40,060 And we will not replace these with CSS grid later. 351 00:19:40,060 --> 00:19:43,720 So instead we will use Flexbox and CSS grid together 352 00:19:43,720 --> 00:19:45,480 when the time comes. 353 00:19:45,480 --> 00:19:46,570 But next, 354 00:19:46,570 --> 00:19:49,920 we will finally build the same layout that we did before 355 00:19:49,920 --> 00:19:52,670 with floats, but with Flexbox. 356 00:19:52,670 --> 00:19:54,683 So stay tuned for that one. 25496

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.