All language subtitles for 040 CSS Theory 5_ Absolute Positioning.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,260 --> 00:00:02,390 Let's talk about 2 00:00:02,390 --> 00:00:06,320 another extremely important aspect of CSS, 3 00:00:06,320 --> 00:00:08,600 which are positioning modes. 4 00:00:08,600 --> 00:00:12,250 And this one is one of the more complex lectures 5 00:00:12,250 --> 00:00:13,880 of this section 6 00:00:13,880 --> 00:00:16,663 and so make sure to pay good attention. 7 00:00:18,870 --> 00:00:20,450 So in CSS, 8 00:00:20,450 --> 00:00:23,520 there are a couple of different positioning modes. 9 00:00:23,520 --> 00:00:25,100 But the more important ones 10 00:00:25,100 --> 00:00:27,970 and the ones we are going to talk about for now 11 00:00:27,970 --> 00:00:30,963 are the normal flow and absolute positioning. 12 00:00:31,800 --> 00:00:34,350 So starting with normal flow, 13 00:00:34,350 --> 00:00:37,400 it is simply the default positioning of elements 14 00:00:37,400 --> 00:00:38,860 on our page. 15 00:00:38,860 --> 00:00:41,890 Or we can also achieve the normal flow 16 00:00:41,890 --> 00:00:45,900 by setting position to the value of relative. 17 00:00:45,900 --> 00:00:49,660 So in this case, we say that an element is 'in flow', 18 00:00:49,660 --> 00:00:52,820 which basically means that the elements are laid out 19 00:00:52,820 --> 00:00:56,860 according to the source code in the HTML. 20 00:00:56,860 --> 00:00:58,660 So this is very straightforward. 21 00:00:58,660 --> 00:01:01,100 It is simply the behavior that we have been seeing 22 00:01:01,100 --> 00:01:02,470 up until this point. 23 00:01:02,470 --> 00:01:06,320 So just keep in mind that that is called normal flow. 24 00:01:06,320 --> 00:01:09,740 Now on the other hand, we have absolute positioning, 25 00:01:09,740 --> 00:01:13,430 which basically allows us to absolutely position elements 26 00:01:13,430 --> 00:01:15,740 anywhere on the page. 27 00:01:15,740 --> 00:01:18,970 Now we can achieve this positioning mode, 28 00:01:18,970 --> 00:01:21,830 so we can position an element absolutely 29 00:01:21,830 --> 00:01:23,970 by setting it's position property 30 00:01:23,970 --> 00:01:26,230 to the value of absolute. 31 00:01:26,230 --> 00:01:27,470 And so in this case, 32 00:01:27,470 --> 00:01:30,760 the element is then removed from the normal flow 33 00:01:30,760 --> 00:01:34,140 and we say that it is 'out of flow'. 34 00:01:34,140 --> 00:01:36,700 Now what happens with this element is 35 00:01:36,700 --> 00:01:40,920 that it completely loses any impact on surrounding elements. 36 00:01:40,920 --> 00:01:44,370 And in fact, it might even overlap them. 37 00:01:44,370 --> 00:01:46,400 So that's something common that happens 38 00:01:46,400 --> 00:01:49,300 with absolutely positioned elements. 39 00:01:49,300 --> 00:01:52,260 Now, in order to actually position the element 40 00:01:52,260 --> 00:01:54,420 that is absolutely positioned, 41 00:01:54,420 --> 00:01:59,010 we can use the top, bottom, left or right properties 42 00:01:59,010 --> 00:02:01,340 in order to position that element. 43 00:02:01,340 --> 00:02:04,460 And that positioning is going to happen in relation 44 00:02:04,460 --> 00:02:07,680 to a relatively positioned container. 45 00:02:07,680 --> 00:02:10,850 Now, I know that this sounds kind of confusing 46 00:02:10,850 --> 00:02:13,993 and so let's actually see this happening in practice. 47 00:02:15,400 --> 00:02:17,600 So what we're going to do in this lecture is 48 00:02:17,600 --> 00:02:21,456 to create a Like button that is located outside 49 00:02:21,456 --> 00:02:23,193 of our centered container. 50 00:02:24,090 --> 00:02:26,680 So let me show that in the demo. 51 00:02:26,680 --> 00:02:29,973 And so here at the very end, we have this Like button. 52 00:02:30,810 --> 00:02:34,790 And as we expand the page for example, 53 00:02:34,790 --> 00:02:37,570 you see that this element always stays 54 00:02:37,570 --> 00:02:40,950 on exactly the same position, right? 55 00:02:40,950 --> 00:02:44,520 So it's not impacted by any of the surrounding elements 56 00:02:44,520 --> 00:02:46,260 and that is even better visible 57 00:02:46,260 --> 00:02:49,900 if we decrease the page even further. 58 00:02:49,900 --> 00:02:53,140 So here we even have that situation where the element 59 00:02:53,140 --> 00:02:57,543 actually overlaps this related posts element right here. 60 00:02:58,410 --> 00:02:59,680 Right? 61 00:02:59,680 --> 00:03:04,320 And so you'll see that this element is not impacting 62 00:03:04,320 --> 00:03:06,720 and it's also not being impacted 63 00:03:06,720 --> 00:03:08,980 by any of the surrounding elements. 64 00:03:08,980 --> 00:03:12,130 It always just simply stays here in this place, 65 00:03:12,130 --> 00:03:15,410 no matter what happens to the rest of the page. 66 00:03:15,410 --> 00:03:17,680 And so this is a great example 67 00:03:17,680 --> 00:03:20,870 of an absolutely positioned element. 68 00:03:20,870 --> 00:03:23,870 Now where should we actually put the mark-up 69 00:03:23,870 --> 00:03:25,180 for this button? 70 00:03:25,180 --> 00:03:27,360 So the HTML... 71 00:03:27,360 --> 00:03:31,360 Well, it doesn't really matter at least for now. 72 00:03:31,360 --> 00:03:36,293 So let's just actually put it here at the end of the body. 73 00:03:38,960 --> 00:03:42,160 So after any other element. 74 00:03:42,160 --> 00:03:46,050 So actually even after the container. 75 00:03:46,050 --> 00:03:49,050 But again, for now that's not the most important part 76 00:03:49,050 --> 00:03:51,200 and we will change this a little bit later. 77 00:03:52,240 --> 00:03:53,880 So let's use the button element 78 00:03:53,880 --> 00:03:57,850 that we have also used in our coding challenges already. 79 00:03:57,850 --> 00:04:00,810 And then here I'm just going to write 'Like', 80 00:04:00,810 --> 00:04:03,710 and then let's just add a nice emoji here, 81 00:04:03,710 --> 00:04:05,080 which in Windows you can do 82 00:04:05,080 --> 00:04:09,800 by hitting control command and space at the same time. 83 00:04:09,800 --> 00:04:12,980 And on Windows, you can open up the emoji picker 84 00:04:12,980 --> 00:04:16,740 by hitting the Windows key plus the dot. 85 00:04:16,740 --> 00:04:19,480 So this is not any VS code extension. 86 00:04:19,480 --> 00:04:21,900 This is simply functionality that is provided 87 00:04:21,900 --> 00:04:23,700 by the operating system. 88 00:04:23,700 --> 00:04:27,080 So again, control command space on the Mac 89 00:04:27,080 --> 00:04:31,090 and Windows plus the dot on Windows 10. 90 00:04:31,090 --> 00:04:34,180 So let's just search for hearts here 91 00:04:36,300 --> 00:04:38,270 and... yeah. 92 00:04:38,270 --> 00:04:40,220 VS code kind of transforms this 93 00:04:40,220 --> 00:04:44,850 into this gray symbol here for some reason. 94 00:04:44,850 --> 00:04:46,543 But nevermind about that. 95 00:04:47,770 --> 00:04:49,380 So let's just come here 96 00:04:49,380 --> 00:04:52,680 and our button should be somewhere here now. 97 00:04:52,680 --> 00:04:55,030 And so right now, it is simply here. 98 00:04:55,030 --> 00:04:57,570 So simply after all the other elements, 99 00:04:57,570 --> 00:05:01,710 because for now, of course, it is in the normal flow still. 100 00:05:01,710 --> 00:05:04,870 So we haven't declared position absolute on it yet. 101 00:05:04,870 --> 00:05:07,510 And so therefore it is simply in the flow 102 00:05:07,510 --> 00:05:09,180 and it's simply positioned right 103 00:05:09,180 --> 00:05:10,823 after all the other elements. 104 00:05:12,189 --> 00:05:14,053 But now let's actually change that. 105 00:05:15,980 --> 00:05:19,053 So let's select the tier using button. 106 00:05:19,890 --> 00:05:22,003 Let's first give it some visual styles. 107 00:05:25,930 --> 00:05:28,210 Adding some padding as well. 108 00:05:28,210 --> 00:05:30,780 And we can also use that trick 109 00:05:30,780 --> 00:05:33,510 of defining the cursor property, 110 00:05:33,510 --> 00:05:36,120 as I also show it to you in the challenge, 111 00:05:36,120 --> 00:05:39,943 and set it to pointer so that we actually get that hand. 112 00:05:42,200 --> 00:05:43,033 Right? 113 00:05:43,033 --> 00:05:44,813 So now it looks a little bit nicer. 114 00:05:45,800 --> 00:05:47,940 And you'll see there's also this hover state, 115 00:05:47,940 --> 00:05:50,360 which we could of course customize, 116 00:05:50,360 --> 00:05:53,230 but let's not spend time on that. 117 00:05:53,230 --> 00:05:56,340 But instead we will now immediately set the position 118 00:05:56,340 --> 00:06:00,393 to absolute just like I showed you in the previous slide. 119 00:06:01,360 --> 00:06:05,120 So let's give it a save and see what it looks like. 120 00:06:05,120 --> 00:06:07,950 But for now it still looks pretty similar. 121 00:06:07,950 --> 00:06:10,530 And that's because we didn't really position it yet 122 00:06:10,530 --> 00:06:14,230 using one of the four properties that I also mentioned, 123 00:06:14,230 --> 00:06:17,410 so top, left, right and bottom. 124 00:06:17,410 --> 00:06:20,960 And so let's for now actually go with top 125 00:06:20,960 --> 00:06:22,530 and set it to zero here, 126 00:06:22,530 --> 00:06:25,010 which is always a good starting point. 127 00:06:25,010 --> 00:06:28,193 And let's say left, zero as well. 128 00:06:29,280 --> 00:06:30,530 Give it a save. 129 00:06:30,530 --> 00:06:32,460 And now it might be gone. 130 00:06:32,460 --> 00:06:34,050 Yeah, it is. 131 00:06:34,050 --> 00:06:37,690 And so that's because now it is right here. 132 00:06:37,690 --> 00:06:40,390 So we set its top position to zero 133 00:06:40,390 --> 00:06:43,360 and so now it's at the very top of the page 134 00:06:43,360 --> 00:06:45,210 because these pixels here, 135 00:06:45,210 --> 00:06:47,880 so the zero pixels, at least for now, 136 00:06:47,880 --> 00:06:51,650 are being counted from the top of the viewport, 137 00:06:51,650 --> 00:06:53,993 so of this visible part of the page here. 138 00:06:55,070 --> 00:06:58,173 So if we change this to bottom, for example, 139 00:06:59,100 --> 00:07:02,450 then it should be here at the bottom of the viewport. 140 00:07:02,450 --> 00:07:05,040 So by default, this element is positioned 141 00:07:05,040 --> 00:07:07,245 in relation to the viewport, 142 00:07:07,245 --> 00:07:08,453 which again is this visible part of the page. 143 00:07:11,272 --> 00:07:12,135 Okay. 144 00:07:12,135 --> 00:07:13,111 So now it stays here, 145 00:07:13,111 --> 00:07:17,200 which is a very weird place for it to be. 146 00:07:17,200 --> 00:07:20,620 But what is important to note here is that in fact, 147 00:07:20,620 --> 00:07:24,350 this element has been completely taken out of the flow 148 00:07:24,350 --> 00:07:27,290 and it's now even hovering over this content. 149 00:07:27,290 --> 00:07:31,160 So it is as if the rest of the content is not even there 150 00:07:31,160 --> 00:07:33,520 and that is becoming even more apparent 151 00:07:33,520 --> 00:07:37,943 as we change, for example, the size of the window. 152 00:07:39,950 --> 00:07:42,613 And let's go back to where we were. 153 00:07:43,650 --> 00:07:45,297 Put it back to top. 154 00:07:45,297 --> 00:07:49,853 And of course we can also move it to some other position. 155 00:07:50,840 --> 00:07:53,630 So it doesn't have to be exactly glued 156 00:07:53,630 --> 00:07:55,600 to the top and the left. 157 00:07:55,600 --> 00:08:00,010 But we can, for example, move it 50 pixels down 158 00:08:00,010 --> 00:08:02,280 and 50 pixels more to the right, 159 00:08:02,280 --> 00:08:04,860 counting here from the left side. 160 00:08:04,860 --> 00:08:05,693 Okay. 161 00:08:05,693 --> 00:08:08,130 So that's the very, very fundamentals 162 00:08:08,130 --> 00:08:10,210 of absolute positioning. 163 00:08:10,210 --> 00:08:12,940 But what is very important to understand is 164 00:08:12,940 --> 00:08:15,680 that these 50 pixels here need to be 165 00:08:15,680 --> 00:08:17,530 in relation to something. 166 00:08:17,530 --> 00:08:20,460 And so, as I just mentioned a minute ago, 167 00:08:20,460 --> 00:08:23,940 by default, these 50 pixels here are in relation 168 00:08:23,940 --> 00:08:25,272 to the viewport, 169 00:08:25,272 --> 00:08:28,850 so the visible part of the page here in the browser. 170 00:08:28,850 --> 00:08:31,710 That's the reason why the element moved down here 171 00:08:31,710 --> 00:08:35,470 to this corner when I set the bottom to zero. 172 00:08:35,470 --> 00:08:38,520 However, that is usually not what we want. 173 00:08:38,520 --> 00:08:42,370 So usually, we want to absolutely position the element 174 00:08:42,370 --> 00:08:45,620 in relation to some other parent element. 175 00:08:45,620 --> 00:08:46,860 And in order to do that, 176 00:08:46,860 --> 00:08:48,780 we need to specifically set the position 177 00:08:48,780 --> 00:08:52,310 of that parent element to relative. 178 00:08:52,310 --> 00:08:53,530 Okay. 179 00:08:53,530 --> 00:08:54,570 So in this case, 180 00:08:54,570 --> 00:08:57,390 we want this element here to be positioned 181 00:08:57,390 --> 00:09:01,181 in the right bottom corner of the page. 182 00:09:01,181 --> 00:09:04,023 So of the page and not of the viewport. 183 00:09:05,370 --> 00:09:06,993 So let's try that. 184 00:09:07,870 --> 00:09:09,590 So let's say... 185 00:09:09,590 --> 00:09:12,760 bottom 50 pixels, 186 00:09:12,760 --> 00:09:15,167 and actually let's keep this here 187 00:09:15,167 --> 00:09:16,410 and just copy it 188 00:09:16,410 --> 00:09:18,260 and then I will comment it out 189 00:09:18,260 --> 00:09:19,993 to keep it here as a reference. 190 00:09:20,970 --> 00:09:25,850 But what we want is 50 pixels from the bottom 191 00:09:25,850 --> 00:09:29,433 and 50 pixels from the right. 192 00:09:30,760 --> 00:09:34,530 So again, it moves it to this place in the viewport, 193 00:09:34,530 --> 00:09:36,520 but we want it down here, 194 00:09:36,520 --> 00:09:38,950 so from the page, right? 195 00:09:38,950 --> 00:09:42,360 And so we need to set position to relative 196 00:09:42,360 --> 00:09:44,380 on the page basically. 197 00:09:44,380 --> 00:09:46,623 And so that is the body element. 198 00:09:48,390 --> 00:09:50,120 So let's do that. 199 00:09:50,120 --> 00:09:51,593 Let's go to body, 200 00:09:52,500 --> 00:09:54,370 which is right here. 201 00:09:54,370 --> 00:09:58,850 and let's set it's position to... 202 00:09:58,850 --> 00:09:59,683 Relative. 203 00:10:00,880 --> 00:10:02,210 Give it a save. 204 00:10:02,210 --> 00:10:04,460 And now as we go down here, 205 00:10:04,460 --> 00:10:05,763 then here it is. 206 00:10:06,950 --> 00:10:08,260 Great. 207 00:10:08,260 --> 00:10:11,400 And let's resize the page a little bit 208 00:10:11,400 --> 00:10:13,230 and now no matter what happens, 209 00:10:13,230 --> 00:10:15,820 the element is always correctly positioned 210 00:10:15,820 --> 00:10:19,770 in the bottom right corner of the body. 211 00:10:19,770 --> 00:10:20,603 Great. 212 00:10:20,603 --> 00:10:23,090 So I hope that made sense. 213 00:10:23,090 --> 00:10:26,960 And of course, it doesn't have to be at the body always. 214 00:10:26,960 --> 00:10:29,110 So we could also position this inside 215 00:10:29,110 --> 00:10:31,040 of any other parent element, 216 00:10:31,040 --> 00:10:32,893 which is not the body. 217 00:10:33,750 --> 00:10:37,110 So let's for example, try here to container. 218 00:10:37,110 --> 00:10:38,300 But in order to do that, 219 00:10:38,300 --> 00:10:42,120 the element actually needs to be inside of the container 220 00:10:42,120 --> 00:10:45,090 because otherwise this is not a parent element 221 00:10:45,090 --> 00:10:47,463 of the button, right? 222 00:10:49,630 --> 00:10:51,440 So let's take this out of here 223 00:10:52,370 --> 00:10:54,340 and put it somewhere else. 224 00:10:54,340 --> 00:10:56,450 And it doesn't really matter where. 225 00:10:56,450 --> 00:10:59,830 All that matters is that it needs to be somewhere 226 00:10:59,830 --> 00:11:01,373 inside of this container, 227 00:11:02,420 --> 00:11:06,240 so this div element with the container class on it. 228 00:11:06,240 --> 00:11:08,550 And I think....actually the place 229 00:11:08,550 --> 00:11:11,140 where it's semantically makes the most sense 230 00:11:11,140 --> 00:11:12,543 is here in the header. 231 00:11:14,350 --> 00:11:17,380 So the header of the article, 232 00:11:17,380 --> 00:11:20,530 so this place here is actually a commonplace 233 00:11:20,530 --> 00:11:23,680 where you would think a Like button makes sense 234 00:11:23,680 --> 00:11:26,350 in a blog post like this, right? 235 00:11:26,350 --> 00:11:27,700 And so let's put it there, 236 00:11:27,700 --> 00:11:30,620 even though visually it's not going to appear there 237 00:11:30,620 --> 00:11:35,160 because again, we are positioning this element absolutely. 238 00:11:35,160 --> 00:11:36,570 So if we give it a save, 239 00:11:36,570 --> 00:11:38,770 then for now nothing will have changed. 240 00:11:38,770 --> 00:11:41,050 It is still right here. 241 00:11:41,050 --> 00:11:43,790 But now let's try to add position relative 242 00:11:43,790 --> 00:11:45,433 to this container here. 243 00:11:47,070 --> 00:11:48,520 So... 244 00:11:48,520 --> 00:11:50,733 Position relative. 245 00:11:52,290 --> 00:11:54,993 And there was a typo somewhere. 246 00:11:56,610 --> 00:11:58,663 And so now it should be somewhere else. 247 00:11:59,950 --> 00:12:03,090 And for now it does look as if it's in the same place, 248 00:12:03,090 --> 00:12:05,290 but if we change this now, 249 00:12:05,290 --> 00:12:09,320 then you'll see that it is here in the top right corner now 250 00:12:09,320 --> 00:12:11,570 of the container element. 251 00:12:11,570 --> 00:12:16,083 So to visualize this, let's inspect the container. 252 00:12:16,970 --> 00:12:19,670 And so here, the blue part is the content. 253 00:12:19,670 --> 00:12:23,220 And so there you see that the Like button is now 50 pixels 254 00:12:23,220 --> 00:12:27,090 from the bottom and from the right of the container. 255 00:12:27,090 --> 00:12:28,300 And again that is 256 00:12:28,300 --> 00:12:31,630 because the container is now the first parent element 257 00:12:31,630 --> 00:12:33,993 that has position set to relative. 258 00:12:35,920 --> 00:12:36,930 All right. 259 00:12:36,930 --> 00:12:39,130 And to make this even more crystal clear, 260 00:12:39,130 --> 00:12:43,023 let's take a look at a graphical explanation of this. 261 00:12:44,460 --> 00:12:46,710 So let's imagine that we have this kind 262 00:12:46,710 --> 00:12:50,130 of yellow element here with the container class 263 00:12:50,130 --> 00:12:53,270 and it has its position set to relative. 264 00:12:53,270 --> 00:12:56,860 Then we have another element which is this one here, 265 00:12:56,860 --> 00:12:58,700 so this orange element 266 00:12:58,700 --> 00:13:02,470 and it has its position set to absolute. 267 00:13:02,470 --> 00:13:06,010 And it also has the top set to 100 pixels 268 00:13:06,010 --> 00:13:09,100 and the left set to 200 pixels. 269 00:13:09,100 --> 00:13:13,230 And so therefore, it will be located exactly 100 pixels 270 00:13:13,230 --> 00:13:17,650 from the top of it's relatively positioned container element 271 00:13:17,650 --> 00:13:20,720 and 200 pixels from the left of it, 272 00:13:20,720 --> 00:13:25,210 again, first relatively positioned container element. 273 00:13:25,210 --> 00:13:26,660 And it's important to mention 274 00:13:26,660 --> 00:13:29,450 that it is the first parent element 275 00:13:29,450 --> 00:13:31,700 that has position set to relative 276 00:13:31,700 --> 00:13:36,580 from which the absolutely positioned element will be placed. 277 00:13:36,580 --> 00:13:37,460 Okay. 278 00:13:37,460 --> 00:13:40,400 And so I hope that with this visualization, 279 00:13:40,400 --> 00:13:42,470 it became even more obvious 280 00:13:42,470 --> 00:13:45,523 how absolute positioning works in CSS. 281 00:13:46,920 --> 00:13:50,050 And let's actually just try another element 282 00:13:50,050 --> 00:13:53,363 as the first relatively positioned container. 283 00:13:54,710 --> 00:13:57,220 So let's do that on the header. 284 00:13:57,220 --> 00:14:00,920 So this button here is inside of this header. 285 00:14:00,920 --> 00:14:02,880 And so we could use this header 286 00:14:02,880 --> 00:14:05,900 as the parent element inside of which we want 287 00:14:05,900 --> 00:14:07,913 to absolutely position this button. 288 00:14:08,890 --> 00:14:11,823 So let's go to a post header. 289 00:14:13,490 --> 00:14:14,903 Place that here. 290 00:14:15,910 --> 00:14:18,070 And now... 291 00:14:18,070 --> 00:14:18,903 Here we go. 292 00:14:19,800 --> 00:14:21,193 So now here it is. 293 00:14:22,890 --> 00:14:26,400 Once again using the dev tools 294 00:14:26,400 --> 00:14:29,640 so we can check out this entire element. 295 00:14:29,640 --> 00:14:33,340 And in fact, it looks like the button is now 50 pixels 296 00:14:33,340 --> 00:14:35,500 from the bottom and from the right 297 00:14:35,500 --> 00:14:38,553 of it's new relatively positioned container. 298 00:14:40,010 --> 00:14:41,470 Okay. 299 00:14:41,470 --> 00:14:43,823 So let's actually remove this one. 300 00:14:44,870 --> 00:14:48,140 So commenting it out and this one as well, 301 00:14:48,140 --> 00:14:51,730 because what we really want is what we did in the beginning. 302 00:14:51,730 --> 00:14:55,383 So we want it to be positioned in relation to the body. 303 00:14:56,350 --> 00:14:57,183 All right. 304 00:14:57,183 --> 00:14:59,440 So I hope this made sense. 305 00:14:59,440 --> 00:15:04,060 And so as a recap of this lecture with absolute positioning, 306 00:15:04,060 --> 00:15:07,040 you can basically put any element that you want 307 00:15:07,040 --> 00:15:09,850 wherever you want it to be on the page, 308 00:15:09,850 --> 00:15:12,920 which of course can be quite helpful. 309 00:15:12,920 --> 00:15:14,180 Now what's important is 310 00:15:14,180 --> 00:15:17,680 that you don't abuse this newfound power. 311 00:15:17,680 --> 00:15:21,690 So don't use this to build complex layouts, for example. 312 00:15:21,690 --> 00:15:25,550 Instead, we use absolute positioning for single elements 313 00:15:25,550 --> 00:15:28,430 like this button or other small things, 314 00:15:28,430 --> 00:15:31,220 just like I will show you in the next video. 315 00:15:31,220 --> 00:15:34,620 But in the real world, we don't use this for example, 316 00:15:34,620 --> 00:15:37,610 to position this menu here, 317 00:15:37,610 --> 00:15:39,690 like here on the top of the page 318 00:15:39,690 --> 00:15:42,840 or to position for example this author image here 319 00:15:42,840 --> 00:15:44,650 anywhere on the page. 320 00:15:44,650 --> 00:15:47,510 For those things, we will actually use special techniques 321 00:15:47,510 --> 00:15:49,470 for building layouts. 322 00:15:49,470 --> 00:15:52,610 So just keep in mind that we always don't simply reach 323 00:15:52,610 --> 00:15:54,500 for absolute positioning, 324 00:15:54,500 --> 00:15:56,770 for example to build layouts. 325 00:15:56,770 --> 00:15:59,330 But all of this will come with practice 326 00:15:59,330 --> 00:16:01,973 and so don't worry too much about it for now. 23512

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