All language subtitles for 051 CHALLENGE 1.en_US

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,320 --> 00:00:03,080 Now it's time for you to build 2 00:00:03,080 --> 00:00:06,920 your own float layout in order to practice everything 3 00:00:06,920 --> 00:00:09,883 that we have learned in this section so far. 4 00:00:11,470 --> 00:00:13,660 And once again, in this section, 5 00:00:13,660 --> 00:00:17,970 we will keep working on this shoe example here. 6 00:00:17,970 --> 00:00:22,690 And so this is how we left it after the last challenge. 7 00:00:22,690 --> 00:00:26,350 And so as always, please use that as a starting point. 8 00:00:26,350 --> 00:00:29,440 And if you don't have the code, then just get it 9 00:00:29,440 --> 00:00:32,203 from a link that I will place in this lecture. 10 00:00:33,100 --> 00:00:34,270 Okay. 11 00:00:34,270 --> 00:00:38,320 But anyway, after building our float layout here, 12 00:00:38,320 --> 00:00:42,640 this is what our component is supposed to be looking like. 13 00:00:42,640 --> 00:00:45,790 Now the very first thing that you should probably do 14 00:00:45,790 --> 00:00:49,240 is to activate that box sizing trick, 15 00:00:49,240 --> 00:00:51,740 so what we learned in the last lecture. 16 00:00:51,740 --> 00:00:54,710 And then from there, you can start using floats. 17 00:00:54,710 --> 00:00:59,170 For example, in order to place this free shipping label here 18 00:00:59,170 --> 00:01:04,070 at the right site, so right beside this price here. 19 00:01:04,070 --> 00:01:06,920 Then down here, as for these colors, 20 00:01:06,920 --> 00:01:09,480 here, we actually don't need to use floats 21 00:01:09,480 --> 00:01:12,200 because we already solved this problem before 22 00:01:12,200 --> 00:01:13,720 in another challenge. 23 00:01:13,720 --> 00:01:17,400 So we used inline blocks to place these colors here 24 00:01:17,400 --> 00:01:20,150 all side by side, remember that? 25 00:01:20,150 --> 00:01:23,350 And so there is no need to change that now. 26 00:01:23,350 --> 00:01:27,100 And then finally, the biggest part of this challenge 27 00:01:27,100 --> 00:01:30,720 is to create this layout where these three parts 28 00:01:30,720 --> 00:01:32,750 are side by side. 29 00:01:32,750 --> 00:01:36,350 So what I want you to do is to create one container, 30 00:01:36,350 --> 00:01:39,580 which will contain this image, 31 00:01:39,580 --> 00:01:42,060 then which will contain one element 32 00:01:42,060 --> 00:01:45,230 which contains all of this, and then one element 33 00:01:45,230 --> 00:01:47,370 which contains all of this. 34 00:01:47,370 --> 00:01:51,400 So right now I think all of this content here 35 00:01:51,400 --> 00:01:55,130 is simply one after another without any separation. 36 00:01:55,130 --> 00:01:58,973 So without being in separate boxes, right? 37 00:02:00,000 --> 00:02:01,950 Yeah. So that's the case. 38 00:02:01,950 --> 00:02:04,200 But right now, what I need you to do 39 00:02:04,200 --> 00:02:07,263 is to put these two here in one box. 40 00:02:09,309 --> 00:02:11,360 So all of these here in another box, 41 00:02:11,360 --> 00:02:14,180 so that you can then put them side by side, 42 00:02:14,180 --> 00:02:16,030 just like we have it here. 43 00:02:16,030 --> 00:02:17,440 All right. 44 00:02:17,440 --> 00:02:19,880 So again, all of this here should be 45 00:02:19,880 --> 00:02:21,770 in one container element. 46 00:02:21,770 --> 00:02:25,490 And then as child elements, there should be this image. 47 00:02:25,490 --> 00:02:29,900 Then a div, so a box which contains all of this. 48 00:02:29,900 --> 00:02:32,733 And then another div, which contains these two. 49 00:02:33,620 --> 00:02:35,720 Then between these elements here, 50 00:02:35,720 --> 00:02:39,150 we have 40 pixels of space. 51 00:02:39,150 --> 00:02:41,890 So here and here. 52 00:02:41,890 --> 00:02:44,410 And then based on that, you will need to figure out 53 00:02:44,410 --> 00:02:47,640 the width of both these elements here. 54 00:02:47,640 --> 00:02:50,160 So this one and this one. 55 00:02:50,160 --> 00:02:53,460 And if that sounds too hard or too confusing, 56 00:02:53,460 --> 00:02:54,520 then don't worry. 57 00:02:54,520 --> 00:02:58,190 You can just use a width of 240 pixels 58 00:02:58,190 --> 00:03:02,460 and I will then explain you how I calculated the exact width 59 00:03:02,460 --> 00:03:03,963 for each of the boxes. 60 00:03:04,870 --> 00:03:05,703 Okay. 61 00:03:05,703 --> 00:03:08,480 And I think that's it for the instructions 62 00:03:08,480 --> 00:03:11,010 that you need for this challenge. 63 00:03:11,010 --> 00:03:14,480 And maybe you can write them down to make it a bit easier 64 00:03:14,480 --> 00:03:16,060 for you to follow them 65 00:03:16,060 --> 00:03:19,070 because actually there's a lot to do here, 66 00:03:19,070 --> 00:03:22,930 and so this really is a real challenge for you. 67 00:03:22,930 --> 00:03:24,620 So once again, don't worry 68 00:03:24,620 --> 00:03:28,120 if you are not able to complete it 100%. 69 00:03:28,120 --> 00:03:30,280 All that matters is that you write at least 70 00:03:30,280 --> 00:03:35,280 some of the code on your own and that you try it, okay? 71 00:03:35,390 --> 00:03:37,480 line:15% So take all the time that you need, 72 00:03:37,480 --> 00:03:39,840 line:15% and then just come back here to the video 73 00:03:39,840 --> 00:03:41,283 line:15% to see my solution. 74 00:03:44,200 --> 00:03:46,510 line:15% So how did you do? 75 00:03:46,510 --> 00:03:50,400 Hopefully you did at least part of this challenge. 76 00:03:50,400 --> 00:03:53,460 And so let's get started. 77 00:03:53,460 --> 00:03:55,840 So as I said, the first thing I'm going to do 78 00:03:55,840 --> 00:04:00,653 is to fix the box model by saying box-sizing, 79 00:04:02,650 --> 00:04:04,193 border-box, of course. 80 00:04:05,170 --> 00:04:09,810 And then let's start by working with these two elements here 81 00:04:09,810 --> 00:04:11,463 to put them side by side. 82 00:04:12,870 --> 00:04:15,700 So that's the price and the shipping. 83 00:04:15,700 --> 00:04:18,160 So that's easy enough. 84 00:04:18,160 --> 00:04:21,630 So float left. 85 00:04:21,630 --> 00:04:24,710 So not keft obviously. 86 00:04:24,710 --> 00:04:25,763 And then here, 87 00:04:26,910 --> 00:04:27,900 float 88 00:04:29,860 --> 00:04:30,693 right. 89 00:04:32,390 --> 00:04:33,880 Okay. 90 00:04:33,880 --> 00:04:36,980 So that doesn't look right somehow. 91 00:04:36,980 --> 00:04:41,180 And so the reason for that is that now this image is bigger 92 00:04:41,180 --> 00:04:44,260 and so it is floating around it as well. 93 00:04:44,260 --> 00:04:46,720 So probably what we should do now already 94 00:04:46,720 --> 00:04:49,410 is to put all the content here 95 00:04:49,410 --> 00:04:51,993 inside that container that I mentioned. 96 00:04:53,010 --> 00:04:55,200 So everything that comes after this image 97 00:04:56,090 --> 00:05:00,750 should be in a new div, which I'm calling here 98 00:05:03,040 --> 00:05:05,083 the product-info. 99 00:05:07,240 --> 00:05:09,890 Okay, so we open that here 100 00:05:10,830 --> 00:05:12,860 and then we want everything in there 101 00:05:12,860 --> 00:05:14,563 until the end of the colors. 102 00:05:15,460 --> 00:05:16,643 So here we close it. 103 00:05:17,890 --> 00:05:19,523 And again, unfortunately, 104 00:05:21,240 --> 00:05:25,133 CodePen does not automatically do the formatting for us, 105 00:05:28,230 --> 00:05:29,750 but let's just leave it like this. 106 00:05:29,750 --> 00:05:33,380 We don't need to worry too much about this small example. 107 00:05:33,380 --> 00:05:37,300 So anyway, I will now put this other content, 108 00:05:37,300 --> 00:05:40,090 so these two here, inside of another div 109 00:05:40,090 --> 00:05:43,560 just as I told you to do in the instructions part. 110 00:05:43,560 --> 00:05:46,683 And this one I'm calling the product-details. 111 00:05:51,220 --> 00:05:55,880 Okay, and then close it right here after this ul 112 00:05:55,880 --> 00:05:57,233 and before the button. 113 00:06:00,420 --> 00:06:03,853 And so now each of them is in its own box. 114 00:06:04,700 --> 00:06:06,230 So we fixed that problem, 115 00:06:06,230 --> 00:06:09,200 that the image is no longer between these two pieces 116 00:06:09,200 --> 00:06:12,240 of content, but we still have a problem, 117 00:06:12,240 --> 00:06:17,240 which is that now this paragraph here is floating around, 118 00:06:17,450 --> 00:06:21,363 or basically in between now these two pieces of content. 119 00:06:22,790 --> 00:06:27,763 And so what we can do is to take a look at this element, 120 00:06:29,310 --> 00:06:31,640 which is this one, the product-description, 121 00:06:31,640 --> 00:06:34,273 and then clear the float right there. 122 00:06:35,270 --> 00:06:36,290 So 123 00:06:37,130 --> 00:06:38,263 where is that? 124 00:06:41,570 --> 00:06:43,250 Let's see. 125 00:06:43,250 --> 00:06:47,083 Well, I think I actually hadn't used this yet, 126 00:06:48,690 --> 00:06:52,423 so let's paste it up here. 127 00:06:55,100 --> 00:06:58,913 And let's say clear both. 128 00:07:00,960 --> 00:07:05,767 And there you go. That fixes that floating problem, right? 129 00:07:07,250 --> 00:07:09,920 So whenever you have a problem with float, 130 00:07:09,920 --> 00:07:12,290 with some element placing itself 131 00:07:12,290 --> 00:07:14,260 where you don't want it to be, 132 00:07:14,260 --> 00:07:17,690 then you can simply clear the float like this. 133 00:07:17,690 --> 00:07:19,680 Now, another solution would have been 134 00:07:19,680 --> 00:07:22,590 to wrap these two elements here 135 00:07:22,590 --> 00:07:25,370 inside of another container element, 136 00:07:25,370 --> 00:07:28,144 and then we could have added the clearfix class 137 00:07:28,144 --> 00:07:29,770 to that container. 138 00:07:29,770 --> 00:07:33,350 So that clearfix hack that I showed you a bit earlier 139 00:07:33,350 --> 00:07:37,260 that we will actually also need for something in a second. 140 00:07:37,260 --> 00:07:39,920 But anyway, this is now done, 141 00:07:39,920 --> 00:07:43,643 and so let's now worry about the overall layout here. 142 00:07:44,520 --> 00:07:47,690 So the elements that participate in the layout 143 00:07:47,690 --> 00:07:50,030 are, of course, these three boxes. 144 00:07:50,030 --> 00:07:52,980 So this image, this box that we just created, 145 00:07:52,980 --> 00:07:56,200 and this one, right? 146 00:07:56,200 --> 00:08:00,113 So that's the image, that's the product-info. 147 00:08:02,120 --> 00:08:04,300 So let's put that here right at the top 148 00:08:04,300 --> 00:08:06,613 of the product information. 149 00:08:08,562 --> 00:08:11,567 And then also the product-details. 150 00:08:14,900 --> 00:08:19,023 And so let's put that here, close to the details. 151 00:08:23,210 --> 00:08:24,580 Okay. 152 00:08:24,580 --> 00:08:26,460 And so, as I was saying, 153 00:08:26,460 --> 00:08:28,120 the first thing that we need to do 154 00:08:28,120 --> 00:08:31,193 is to determine a width for these elements. 155 00:08:33,300 --> 00:08:34,343 All right. 156 00:08:35,350 --> 00:08:37,090 So let's do that. 157 00:08:37,090 --> 00:08:38,500 And I will add a comment here 158 00:08:38,500 --> 00:08:42,000 so that I can show you the math that is happening. 159 00:08:42,000 --> 00:08:46,727 So the total width of this container is 825, right? 160 00:08:47,800 --> 00:08:51,630 And it also has a border of four on each side. 161 00:08:51,630 --> 00:08:55,540 So the math here is 280 pixels 162 00:08:55,540 --> 00:09:00,180 minus eight, which are the two borders on each side, 163 00:09:00,180 --> 00:09:02,480 then minus 250, 164 00:09:02,480 --> 00:09:04,563 which is the width of this image. 165 00:09:05,670 --> 00:09:06,750 So 166 00:09:07,730 --> 00:09:08,630 where is that? 167 00:09:08,630 --> 00:09:09,463 Let's see. 168 00:09:13,990 --> 00:09:16,083 That doesn't seem to be somewhere here. 169 00:09:17,760 --> 00:09:22,093 Ah, yeah. Actually we set that height and width right here. 170 00:09:22,990 --> 00:09:27,603 So that's why I couldn't see it, but I knew it was 250. 171 00:09:28,550 --> 00:09:32,403 So we need to subtract that as well from the total. 172 00:09:33,340 --> 00:09:35,000 So that's not 280. 173 00:09:35,000 --> 00:09:36,973 That's 825. 174 00:09:39,420 --> 00:09:41,750 So don't know where that came from. 175 00:09:41,750 --> 00:09:43,560 And then remember how I said 176 00:09:43,560 --> 00:09:48,480 that we want 40 pixels right here and right here. 177 00:09:48,480 --> 00:09:49,940 And so that is also space 178 00:09:49,940 --> 00:09:52,360 that we cannot use for the columns. 179 00:09:52,360 --> 00:09:55,713 So we need to subtract that as well. So minus 80. 180 00:09:57,690 --> 00:10:00,760 So basically the result of this calculation here 181 00:10:00,760 --> 00:10:04,310 will be the exact amount of space that we have remaining 182 00:10:04,310 --> 00:10:06,730 to fill up with the columns. 183 00:10:06,730 --> 00:10:10,380 So I will just do the math here using this functionality 184 00:10:10,380 --> 00:10:13,870 on the Mac, but you can just do it any other way. 185 00:10:13,870 --> 00:10:16,280 So 850 minus eight, 186 00:10:16,280 --> 00:10:18,020 minus 250 187 00:10:18,020 --> 00:10:19,690 minus 80. 188 00:10:19,690 --> 00:10:22,250 So that is the total width that is available 189 00:10:22,250 --> 00:10:25,740 for the two columns, but we have two of them. 190 00:10:25,740 --> 00:10:30,200 And so we need to divide all of this by two. 191 00:10:30,200 --> 00:10:33,380 So wrap it in parentheses, divide by two. 192 00:10:33,380 --> 00:10:37,160 And so the result is 243.5 pixels. 193 00:10:37,160 --> 00:10:42,160 So let's not use the point and let's just use 443 pixels. 194 00:10:44,140 --> 00:10:45,080 So 195 00:10:45,080 --> 00:10:45,913 width 196 00:10:47,039 --> 00:10:50,573 243 pixels. 197 00:10:52,440 --> 00:10:54,023 So divide it by two. 198 00:10:55,600 --> 00:10:59,093 Then let's put the same on the other column here. 199 00:11:01,040 --> 00:11:02,323 So that's this one. 200 00:11:04,400 --> 00:11:05,590 Okay. 201 00:11:05,590 --> 00:11:08,200 So that worked and now all we have to do 202 00:11:08,200 --> 00:11:11,163 is to float all of these three elements. 203 00:11:12,750 --> 00:11:17,750 So first, the image, which actually we haven't selected yet. 204 00:11:20,660 --> 00:11:22,020 So let's give it a class 205 00:11:23,450 --> 00:11:24,750 of 206 00:11:24,750 --> 00:11:27,230 product image 207 00:11:29,660 --> 00:11:31,140 and let's put that 208 00:11:35,430 --> 00:11:37,093 somewhere here, maybe. 209 00:11:38,390 --> 00:11:39,340 Well, actually not. 210 00:11:40,590 --> 00:11:43,323 Let's put it actually outside here. 211 00:11:45,100 --> 00:11:48,470 So the height and width, we don't need to define using CSS 212 00:11:48,470 --> 00:11:50,860 because that's already in here, 213 00:11:50,860 --> 00:11:53,060 but let us define the float 214 00:11:54,520 --> 00:11:56,850 and float it to the left. 215 00:11:56,850 --> 00:12:00,420 And now the same with all the other ones. 216 00:12:00,420 --> 00:12:03,323 So float to the left. 217 00:12:04,920 --> 00:12:07,533 And like this. 218 00:12:08,430 --> 00:12:11,650 And let's copy this simply for the other one 219 00:12:15,690 --> 00:12:17,443 and float left as well. 220 00:12:20,720 --> 00:12:22,150 All right. 221 00:12:22,150 --> 00:12:24,620 So that looks nice already. 222 00:12:24,620 --> 00:12:27,240 Now we just need to add those 40 pixels 223 00:12:27,240 --> 00:12:31,740 of spacing that we wanted, so let's use margin for that. 224 00:12:31,740 --> 00:12:34,340 So I will just add a margin right on the image 225 00:12:34,340 --> 00:12:36,383 and on this element right here. 226 00:12:38,132 --> 00:12:41,937 So margin-right 40 pixels. 227 00:12:44,100 --> 00:12:47,533 And then also on this one. 228 00:12:49,150 --> 00:12:53,520 And with that, well, we are looking pretty close already 229 00:12:53,520 --> 00:12:56,800 to our final layout, right? 230 00:12:56,800 --> 00:13:00,490 Let's just add some cosmetic details here. 231 00:13:00,490 --> 00:13:04,313 So adding some padding here to the top of this one. 232 00:13:06,100 --> 00:13:07,030 So padding 233 00:13:09,480 --> 00:13:11,083 40 pixels, let's say. 234 00:13:12,140 --> 00:13:14,290 Well, that's a bit too much. 235 00:13:14,290 --> 00:13:15,390 Okay. 236 00:13:15,390 --> 00:13:18,860 And now I'm noticing that these colors 237 00:13:18,860 --> 00:13:20,833 somehow no longer fit down here, 238 00:13:21,690 --> 00:13:23,933 so let's see why that might be. 239 00:13:24,860 --> 00:13:27,840 Well, maybe we need to decrease the space a little bit 240 00:13:27,840 --> 00:13:32,380 between them, or actually I did a mistake here. 241 00:13:32,380 --> 00:13:34,800 So added the padding to all the sides, 242 00:13:34,800 --> 00:13:38,610 and so therefore is now all too small. 243 00:13:38,610 --> 00:13:42,960 So I just wanted a padding top of 20 pixels. 244 00:13:42,960 --> 00:13:46,470 Yeah. And now that looks a lot better of course. 245 00:13:46,470 --> 00:13:49,570 Now next up, let's add some margin here 246 00:13:49,570 --> 00:13:51,283 to this free shipping label. 247 00:13:52,150 --> 00:13:56,563 So to kind of manually align it to this value here. 248 00:13:57,830 --> 00:13:59,673 So margin top, 249 00:14:01,790 --> 00:14:05,380 let's say eight pixels. 250 00:14:05,380 --> 00:14:07,870 And by the way, all of these things, 251 00:14:07,870 --> 00:14:11,560 like manually aligning elements like this, 252 00:14:11,560 --> 00:14:13,280 will all be a thing of the past 253 00:14:13,280 --> 00:14:16,670 once we start using Flexbox, okay? 254 00:14:16,670 --> 00:14:21,000 So Flexbox will be so helpful. It's gonna be incredible. 255 00:14:21,000 --> 00:14:25,860 We will not have to do any of these like guessing numbers 256 00:14:25,860 --> 00:14:27,780 to align vertically. 257 00:14:27,780 --> 00:14:31,730 We also will not have to do manual calculations 258 00:14:31,730 --> 00:14:33,830 of width, like this. 259 00:14:33,830 --> 00:14:37,730 So all of this will be automatically figured out by Flexbox 260 00:14:37,730 --> 00:14:39,210 in the future. 261 00:14:39,210 --> 00:14:41,360 So that's going to be so helpful. 262 00:14:41,360 --> 00:14:44,880 And I can't wait to show it to you actually. 263 00:14:44,880 --> 00:14:48,453 Now let's just add some space here to this paragraph. 264 00:14:49,830 --> 00:14:54,400 So let's see if I have already selected that. 265 00:14:54,400 --> 00:14:55,393 Yeah, here it is. 266 00:14:56,230 --> 00:15:00,520 So let's say margin-bottom 267 00:15:00,520 --> 00:15:04,960 of 10 pixels right there. 268 00:15:04,960 --> 00:15:08,570 And then finally, let's fix the spacing here a little bit. 269 00:15:08,570 --> 00:15:11,880 So here is a lot more spacing than here 270 00:15:11,880 --> 00:15:14,580 and that's because we still have that margin-top 271 00:15:14,580 --> 00:15:16,253 on the product details. 272 00:15:18,240 --> 00:15:19,673 So let's fix that. 273 00:15:21,730 --> 00:15:24,560 So on this product details title. 274 00:15:24,560 --> 00:15:25,973 So this is the one I mean. 275 00:15:27,490 --> 00:15:31,780 So let's get rid of that and let's instead add a margin 276 00:15:32,980 --> 00:15:37,980 to the top of 20 pixels, like we did here in this other one. 277 00:15:38,510 --> 00:15:40,870 Actually here, I think we used padding, 278 00:15:40,870 --> 00:15:43,630 but margin is better of course. 279 00:15:43,630 --> 00:15:46,440 So let's go back also to this other box 280 00:15:48,260 --> 00:15:49,403 and, 281 00:15:51,490 --> 00:15:55,430 yeah, so instead of padding, let's use margin here. 282 00:15:55,430 --> 00:15:58,180 And so that looks the same. 283 00:15:58,180 --> 00:16:01,373 And with this, we are actually finished. 284 00:16:02,410 --> 00:16:05,293 So that looks just like this. 285 00:16:06,500 --> 00:16:10,510 And so challenge completed successfully. 286 00:16:10,510 --> 00:16:12,370 Now there are some things that we could 287 00:16:12,370 --> 00:16:14,290 have done a bit differently. 288 00:16:14,290 --> 00:16:15,483 So for example, I told you 289 00:16:15,483 --> 00:16:18,460 that we would need the clearfix class, 290 00:16:18,460 --> 00:16:21,553 but actually we ended up not needing it. 291 00:16:22,440 --> 00:16:25,170 So what we could have done would have been 292 00:16:25,170 --> 00:16:29,000 to wrap these three elements here into a container. 293 00:16:29,000 --> 00:16:32,620 And actually that's what I told you to do, right? 294 00:16:32,620 --> 00:16:35,553 So, well, why not then just do that? 295 00:16:36,390 --> 00:16:38,790 So that's not too hard. 296 00:16:38,790 --> 00:16:39,973 So let's do that here. 297 00:16:42,160 --> 00:16:43,900 A div 298 00:16:43,900 --> 00:16:44,910 with a class 299 00:16:46,170 --> 00:16:48,733 of container. 300 00:16:49,950 --> 00:16:53,843 And then we need to close it right at the very end 301 00:16:55,380 --> 00:16:56,533 before this button. 302 00:17:00,220 --> 00:17:01,053 All right. 303 00:17:02,200 --> 00:17:05,140 So let's select that container here 304 00:17:05,140 --> 00:17:06,693 to give it a background color. 305 00:17:13,800 --> 00:17:14,980 Okay. 306 00:17:14,980 --> 00:17:17,140 And now you see that the color 307 00:17:17,140 --> 00:17:18,963 is actually nowhere to be seen. 308 00:17:19,960 --> 00:17:24,960 So in order to figure out why that is, let's inspect this. 309 00:17:26,530 --> 00:17:30,100 So we have the article and then in there is the h2 310 00:17:30,100 --> 00:17:32,360 and then there is the container. 311 00:17:32,360 --> 00:17:37,360 But now you see that this container has a height of 0. 312 00:17:37,420 --> 00:17:40,460 So why do you think that is? 313 00:17:40,460 --> 00:17:44,790 Well, once again, it's because of collapsed heights. 314 00:17:44,790 --> 00:17:47,430 So this element technically has no height 315 00:17:47,430 --> 00:17:51,497 because all of its child elements are floated, right? 316 00:17:53,720 --> 00:17:56,160 So the child elements are these three. 317 00:17:56,160 --> 00:17:59,420 So the image, it is the product-info 318 00:17:59,420 --> 00:18:01,240 and the product-details. 319 00:18:01,240 --> 00:18:05,470 And so remember how we floated all of these three elements. 320 00:18:05,470 --> 00:18:08,270 And so that means that the container right now 321 00:18:08,270 --> 00:18:11,070 has no element that is not floated. 322 00:18:11,070 --> 00:18:13,363 And so therefore its height collapsed. 323 00:18:15,120 --> 00:18:19,810 Okay, and if for some reason we really needed to fix that, 324 00:18:19,810 --> 00:18:23,723 then we could use a clearfix class for that. 325 00:18:27,730 --> 00:18:31,103 So again, this does not need to be called clearfix, 326 00:18:33,066 --> 00:18:35,913 but this is just a general name that is used. 327 00:18:36,910 --> 00:18:39,963 So content is nothing. 328 00:18:41,200 --> 00:18:45,840 Display is block. 329 00:18:45,840 --> 00:18:49,630 And of course finally clear 330 00:18:49,630 --> 00:18:53,030 is set to both. 331 00:18:53,030 --> 00:18:55,440 And let's wait for it. 332 00:18:55,440 --> 00:18:59,363 Ah, of course, we also need to add it here to this element. 333 00:19:01,470 --> 00:19:03,180 Clearfix. 334 00:19:03,180 --> 00:19:04,013 And 335 00:19:05,290 --> 00:19:06,123 yeah. 336 00:19:06,123 --> 00:19:07,750 So now that turned red, 337 00:19:07,750 --> 00:19:11,823 which means that the container is back to having a height. 338 00:19:13,930 --> 00:19:15,490 Okay. 339 00:19:15,490 --> 00:19:17,343 And let's comment that out here. 340 00:19:18,270 --> 00:19:21,110 And so yeah, now that's really it. 341 00:19:21,110 --> 00:19:23,640 But again, it actually also worked 342 00:19:23,640 --> 00:19:25,870 without this container element 343 00:19:25,870 --> 00:19:29,870 because we had all of the space here nicely divided up. 344 00:19:29,870 --> 00:19:32,370 So we set exactly how wide each 345 00:19:32,370 --> 00:19:34,460 of these elements here should be, 346 00:19:34,460 --> 00:19:36,720 and so therefore there was no space 347 00:19:36,720 --> 00:19:40,050 for any of the next element, in this case, the button, 348 00:19:40,050 --> 00:19:41,453 to float around them. 349 00:19:42,920 --> 00:19:43,753 Okay. 350 00:19:44,710 --> 00:19:48,810 But again, I'm sure that sounds a bit confusing 351 00:19:48,810 --> 00:19:51,950 and the reason for that is that I'm not going super deep 352 00:19:51,950 --> 00:19:55,240 into how floats and clears actually work 353 00:19:55,240 --> 00:19:57,120 because, for the rest of the course, 354 00:19:57,120 --> 00:20:01,550 we will now replace them with Flexbox and CSS Grid, 355 00:20:01,550 --> 00:20:05,030 which make all of this a lot, lot easier. 356 00:20:05,030 --> 00:20:06,190 Trust me. 357 00:20:06,190 --> 00:20:08,230 So if you're excited about that, 358 00:20:08,230 --> 00:20:10,800 then don't wait and let's move right 359 00:20:10,800 --> 00:20:12,493 to our next lecture here. 25368

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