Using CSS Position Absolute: some practical examples

  Рет қаралды 123,732

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 157
@ganeastefan4287
@ganeastefan4287 4 жыл бұрын
Just wanted to say @kevin powell I've been browsing through your channel for the past few days, spending a few hours at a time and your content is so good I just don't even know where to start and where to keep going, sometimes. Thanks for your amazing work, it helps a ton!
@KevinPowell
@KevinPowell 4 жыл бұрын
Glad that you're enjoying my content! 😊
@eddykagia4212
@eddykagia4212 3 жыл бұрын
This blew my mind. So subtle yet so effective
@trainerkellysnetwork
@trainerkellysnetwork 3 жыл бұрын
I know this video is old, but I want to say THANK YOU! I struggled for hours trying to figure out how to align a button inside of a DIV element that was still responsive and I could not figure out how to do it. Google wasn't really showing me anything that was helpful. All it took was watching this video and being reminded that the parent element (in this case, my DIV) needed positioning itself. 😭 Thank you SO much for making this very clear tutorial! Thank you, thank you, THANK YOU!!!
@darshanpandya1087
@darshanpandya1087 2 жыл бұрын
thank you kevin for all the amazing videos you share , i try to watch as soon as i got notified and try to use on my projects too.
@nlorens
@nlorens 3 жыл бұрын
Thank you Kevin for explaining the logic behind every step, it is super helpful to understand the concept. I really enjoyed trying out this fun project :)
@seanpheneger6632
@seanpheneger6632 6 жыл бұрын
Kevin, you know in Emmett you can type loremX (where x is the number of words you want it to generate) i.e. lorem10 and then tab and emmett will auto generate 10 lorem words instead of saving lorem bits on a different doc to cut and paste. p.s. love the content. always learn something new every video you put out
@KevinPowell
@KevinPowell 6 жыл бұрын
It never EVER works for me, it always gives me a tag instead! I've used it in Atom, VS Code and Codepen and I wish it would work SOOO much, haha. I think I had it work once, and I don't know what I did!
@ShotgunChoda
@ShotgunChoda 6 жыл бұрын
Don't know if you just made a typo here, but it's lorEm, not lorUm, maybe that's what's tripping you up.
@barelyviable5004
@barelyviable5004 6 жыл бұрын
also it doesn't work when Capitalized, it has to lowercase, sometimes I mess up there =p
@wshah5761
@wshah5761 6 жыл бұрын
type lorem5 and press tab, it should work :-D, I also struggled with it before
@aditnetral
@aditnetral 5 жыл бұрын
@@KevinPowell wow
@sage5296
@sage5296 3 жыл бұрын
The content on this channel is great, I'm learning CSS on my own as I'm working through CSSBattles, and this is a really nice way to augment that while also learning the proper way to do things to balance out any bad habits I'm forming with CSSBattles!
@yetanotherusername12
@yetanotherusername12 6 жыл бұрын
Your videos always clear up whatever impossible mess I've created in my code as I stumble through learning web coding. Thanks!
@KevinPowell
@KevinPowell 6 жыл бұрын
Haha, glad I'm able to help out a little :)
@nickbrown6754
@nickbrown6754 3 жыл бұрын
I've been struggling all day with the positioning of a responsive video that was suppose to be about 1/3 of the screen wide and sit above the fold in the bottom right on all screen sizes above 992px wide. After watching this video the solution seems so obvious and I can't believe I was being so thick. Thank you for kicking my brain back into gear 🤘
@Devendrakr63
@Devendrakr63 3 жыл бұрын
He is King of CSS.
@A_Lesser_Man
@A_Lesser_Man 5 жыл бұрын
that looked great! yes, you could DRY it up a bit. and i had no idea you could do THAT to a shadow! wow. neat.
@matthewashworth4992
@matthewashworth4992 4 жыл бұрын
Thank you K-Pow love your videos, they make my corner of the web nicer, You are a star!
@Seantf12345
@Seantf12345 4 жыл бұрын
Awesome showcase of the absolute position! Thanks for this a real inspiration!
@sivaganesh4489
@sivaganesh4489 Жыл бұрын
Kevin, GOAT of css
@nizamuddinshaikh3185
@nizamuddinshaikh3185 5 жыл бұрын
Topic excellently explained! Now, I am clear about position : absolute. Thank you, KP. 😃
@whatsaguygottado2669
@whatsaguygottado2669 5 жыл бұрын
Interesting video! Gave me all kinds of things to think about w/ positioning. Keep-up the good work!
@gilmoretj
@gilmoretj 6 жыл бұрын
Kevin, I am a big fan of your videos, especially the Five-minute Fridays. One comment regarding CSS positioning: Absolute positioning is not dependent on an ancestor having a position property but on having an ancestor defining a position other than the default of static. Keep up the good work.
@Alessandro-nq3tm
@Alessandro-nq3tm 5 жыл бұрын
Amazing tutorial mate! So useful
@westfield90
@westfield90 5 жыл бұрын
Thank you. Nothing like real world examples to explain this stuff.
@chinmaykumar7975
@chinmaykumar7975 4 жыл бұрын
You made everything so much easy and clear . Thank you very much.
@TheElkster
@TheElkster 4 жыл бұрын
Really loved the use of z-index and creating layers - losing luminosity with other elements having an rgba background has always stumped me - but this now explains how to avoid it! Thanks Kevin! :)
@rofazayn
@rofazayn 6 жыл бұрын
Thank you Kevin, I love your videos.
@KevinPowell
@KevinPowell 6 жыл бұрын
Not a problem, I'm glad to hear that you like them :D
@luizmelo8611
@luizmelo8611 6 жыл бұрын
Thank you very much, sir! Your tutorials are awesome and to the point! I wish you the best!
@esraamohamed5601
@esraamohamed5601 2 жыл бұрын
Thank you so much for all you have done!
@sumitsahu2338
@sumitsahu2338 3 ай бұрын
Amazing content and teaching.
@miguelbm1989
@miguelbm1989 2 жыл бұрын
I had to do an AB testing for my work. This video helped me finish it :) thank you so much
@thilakamn575
@thilakamn575 4 жыл бұрын
Awesome presentation and Thank you
@ellaamaechi-qk9ol
@ellaamaechi-qk9ol 10 ай бұрын
i really learnt a lot from this
@christinejurewicz3057
@christinejurewicz3057 6 жыл бұрын
Thanks Kevin, this really clarified some things regarding positioning
@KevinPowell
@KevinPowell 6 жыл бұрын
Awesome, glad it helped Christine :)
@GeorgeFlorian12
@GeorgeFlorian12 6 жыл бұрын
Awesome video, man, like always ! As a total beginner I don't know when or where some code will work or not, like you the 'height' example in this video. There are a lot of tricks related to what will work and what will not depending on 'position' or 'display' or who knows what. I think that explaining "the missing link" (for me at least) would make for a great video. Or do you already have videos about that ? I haven't seen all of your video, obviously :))
@GeorgeFlorian12
@GeorgeFlorian12 6 жыл бұрын
Like, even here, in this video: the 'width' of the parent div is 40% and the 'height' and 'width' of the img are set at 100%,. The img has a 705 width/height, right ? So it's a square. Why did it change its aspect ratio and began looking like a rectangle ?
@KevinPowell
@KevinPowell 6 жыл бұрын
Because CSS is really strange, lol. I'd love to make a missing link video, but that would most of CSS, lol. It's one of those things that, the more you use it the more you figure out the subtleties of it. As much as possible I try to get into these subtleties in my videos, but there are sooooo many! It can definitely be frustrating as you are learning, but you'll start figuring it out!
@davidmarcos3661
@davidmarcos3661 5 жыл бұрын
@@KevinPowell I was wondering the same issue about the aspect ratio of the image, I guess i'll have to move on and accept that CSS is strange, lmao
@franktielemans6624
@franktielemans6624 6 жыл бұрын
Damn,, this was clever
@KevinPowell
@KevinPowell 6 жыл бұрын
Glad you liked it!
@infosandfacts7536
@infosandfacts7536 4 жыл бұрын
Awesome stuff. Thanks a lot.
@Fliteska
@Fliteska 5 жыл бұрын
That was really cool, never thought of using pseudo elements for cutting through an element. The card looks like it could be a digital boarding pass
@mananwebandall1203
@mananwebandall1203 5 жыл бұрын
Very cool boss .... Just awesome explanation...👍👍👍
@zahidhossainarpo5043
@zahidhossainarpo5043 4 жыл бұрын
these are awesome man..thanks a lot
@DuyenPhanLan
@DuyenPhanLan 3 жыл бұрын
Great content! Thanks
@DavidWyatt
@DavidWyatt 6 жыл бұрын
Excellent, as always! A great follow-up video would be writing the CSS that would allow this to degrade gracefully at mobile breakpoints. That's probably where most of us have the most problems.
@DavidWyatt
@DavidWyatt 6 жыл бұрын
I forked your original pen and added a breakpoint. Because your original CSS was so clean, it only took a few lines of code to make this card look great on mobile. Take a look at the modified pen codepen.io/designoneweb/pen/jKZbzW and let me know what you think. Keep up the great videos!
@KevinPowell
@KevinPowell 6 жыл бұрын
I find it easier to design something more basic as the mobile one, and then add things and make it more complicated for larger screens, instead of stripping stuff away. But yeah, that's a good topic idea, though it does delve into design a lot as well, and making design decisions for different screen sizes.
@KevinPowell
@KevinPowell 6 жыл бұрын
Sorry I hadn't seen the followup comment, KZbin had flagged it (because it had a link in it, I'm guessing). Really nice stuff, glad you took the time to do that, it looks great :)
@georgesmith3022
@georgesmith3022 6 жыл бұрын
thanks kevin, interesting stuff definitely
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks George :D
@MartinHAndersen
@MartinHAndersen 5 жыл бұрын
Awesome, thanks again
@udarakasun
@udarakasun 6 жыл бұрын
Thanks kevin. It's cool
@nargesbayat277
@nargesbayat277 3 жыл бұрын
That is great!thank you very much
@nithinmuniraju4482
@nithinmuniraju4482 6 жыл бұрын
Even you too awesome. Nice teaching, all your tutorials makes me perfect of some topics. Thank you a lot 👍👍
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks so much, I'm glad you're enjoying the tuts!
@monk333
@monk333 6 жыл бұрын
Nicely done!
@ElNicopewpew
@ElNicopewpew 6 жыл бұрын
Love your videos, great job !
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks a lot, glad you liked it :)
@CreativeSequence
@CreativeSequence 5 жыл бұрын
Great video very helpful
@Abhishek-tr4oi
@Abhishek-tr4oi 5 жыл бұрын
What a design awesome 😍
@boyacosweep
@boyacosweep 2 жыл бұрын
Amazing!
@Diamonddrake
@Diamonddrake 4 жыл бұрын
Great tutorial!
@michajankowski3615
@michajankowski3615 6 жыл бұрын
Cool example!
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks :)
@davidepalombo2141
@davidepalombo2141 2 жыл бұрын
Thank you!
@jaimesastre6393
@jaimesastre6393 6 жыл бұрын
thank you, awesome ! really good explained!
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks a lot, glad you liked it :)
@asdfghilal
@asdfghilal 2 жыл бұрын
You are the best!
@ArturBrosig
@ArturBrosig 3 жыл бұрын
Awesome. On 10:25 you say that the border is 1px thick, but isn't it actually 2px thick? (1px left and 1px right)
@siriusgd4753
@siriusgd4753 6 жыл бұрын
Very nice!
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks :)
@heidischorlemmer4407
@heidischorlemmer4407 2 жыл бұрын
Hi Kevin, what haben I to do to get the sourcecode of your videos? Must I make a subscription ? You videos are so great .
@Honza475
@Honza475 5 жыл бұрын
Liked and subbed. Very useful videos. Keep it up 👍
@AndrejDaiker
@AndrejDaiker 6 жыл бұрын
Awesome!
@anuranjansrivastav9864
@anuranjansrivastav9864 6 жыл бұрын
Great video...
@cindykee3719
@cindykee3719 5 жыл бұрын
Is z-index affected by parent and child positions? Or is it always global to the whole ? I was a little confused by the tweaks you did there. I am learning so much about CSS that I didn't know before with your videos. I am a full-stack developer and I have never studied CSS specifically. I just have kind of picked it up along the way. And I know enough that a beginner's CSS course would bore me just to fill in my gaps, so your videos are super-helpful for that gap-filling! And for advanced techniques. Thank you!
@joeldcanfield_spinhead
@joeldcanfield_spinhead 5 жыл бұрын
I love seeing your designer mind at work. Re: the shadow on the left end, would it be feasible to add another element behind that bit, and put the box-shadow on that? That's my Photoshop cheat, so I'm curious how you might pull it off here. It'd really finish off the design.
@KevinPowell
@KevinPowell 5 жыл бұрын
Really good point. We could add a second shadow onto that ::after element to pull it off :) - box-shadow: inset 12px 0 10px -10px rgba(0,0,0,.5), 20px 0 40px rgba(0,0,0,.25);
@mrMinstrel
@mrMinstrel 6 жыл бұрын
Very Nice...thanks!
@KevinPowell
@KevinPowell 6 жыл бұрын
No problem at all!
@thedacian123
@thedacian123 3 жыл бұрын
Can you explain position absolute and overflow hidden of postionated parent,please.? I've seen some implemetation of slidders using this one.Thank you!
@boggeshzahim3713
@boggeshzahim3713 5 жыл бұрын
This is so BADASS
@mohammedriyazuddin5649
@mohammedriyazuddin5649 6 жыл бұрын
you are awesome man...
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks!
@varsharaorane
@varsharaorane 6 жыл бұрын
very nice video
@MontyKsycki
@MontyKsycki 5 жыл бұрын
Thank You!!!! :)
@cannabisanomaly
@cannabisanomaly 2 жыл бұрын
Hey Kevin, thank you SO much for all of your work; you're singlehandedly teaching me how to be a web developer. I noticed something pretty odd when it comes to the 1px solid white border you've done for the card decoration. I'm using chrome and I noticed that when adjusting the browser window, the 1px border seems to sometimes appear not solid. But when adjusting the window some more, it goes in and out from looking to solid to looking like there's some space within the border, almost like it's two parallel lines. Do you have any idea what is causing that?
@diegounanue
@diegounanue 5 жыл бұрын
Can you do the same with flex?
@bijintsy
@bijintsy 6 жыл бұрын
awsome!!!
@workingTchr
@workingTchr 2 жыл бұрын
I needed a menu type element and all the pre-made code I found was way too complex (trying to be too many things) so I had to make my own. Absolute position is used in all of the menu controls so they can overlap content they drop down over (like a Select). So that's what got me here: menus.
@Rocadamis
@Rocadamis 3 жыл бұрын
So, how would you go about putting a shadow behind the yellow banner sticking out on either side? Maybe put a negative z-index box behind each one with a box-shadow?
@alenjose3903
@alenjose3903 3 жыл бұрын
how does the before and after work to create the border
@amyp.575
@amyp.575 5 жыл бұрын
why does the yellow on the outside on the right look like it's higher?
@nathancornwell1455
@nathancornwell1455 5 жыл бұрын
ever since i started doing Kevin's course on scrimba i just keep wanting to pause the video and look at the code lol
@amyp.575
@amyp.575 5 жыл бұрын
Same! And it's his only Scrimba which makes me sad! The CSS HTML one
@nathancornwell1455
@nathancornwell1455 5 жыл бұрын
@@amyp.575 indeed, I do hope to see him do more courses in the future. I wish he could do all his videos there instead of youtube but unfortunately thats not the way scrimba works....
@amyp.575
@amyp.575 5 жыл бұрын
@@nathancornwell1455 It's not? The only thing I know about Scrimba is that he was on it and the guy who tried to teach HTML was awful but this was after Kevin so I was comparing the two lol How do we talk him into making more?? Lol I can't learn from anyone else and I have tried and tried and tried! He has my future in his hands!! LOL
@nathancornwell1455
@nathancornwell1455 5 жыл бұрын
@@amyp.575 what i mean is how kevin uploads videos weekly on KZbin..i wish he could do that on scrimba....kevin put out a course on responsive web design with CSS/HTML but he hasn't put more videos up because thats not how scrimba is , he would have to make a whole new course i assume..but i wish he could have like his videos on animations, transforms, etc on scrimba so we could play around with those while we learn but for now we have his youtube videos , codepens, and github.
@joe-un1ky
@joe-un1ky 5 жыл бұрын
Damn, you're a CSS artist
@KevinPowell
@KevinPowell 5 жыл бұрын
Thanks 😊
@mk9834
@mk9834 4 жыл бұрын
amazinggggg!
@Rebbelde
@Rebbelde 4 жыл бұрын
Whats the keyboard hot key to autocomplete image tags and how you define width and height in source ? I tried it but it didn't work
@alexanderphilippovich3047
@alexanderphilippovich3047 5 жыл бұрын
I mean the view of the picture, not changing the size. So Ican see the windows of the house for example.
@KashmirTechUniverse2432
@KashmirTechUniverse2432 2 жыл бұрын
Which things makes Css responsiveness ?
@pushpakgupta7396
@pushpakgupta7396 5 жыл бұрын
but when i do position absolute on card body instead of position relative then the card body goes to top left of the window....but your card remained there only...pls someone explain
@alexanderphilippovich3047
@alexanderphilippovich3047 5 жыл бұрын
Hi! Do you know how to move the omg picture a little to the right or top, by the x an y axis?
@joaoribeiro9575
@joaoribeiro9575 5 жыл бұрын
Hi Kevin, I am still a bit confused, what is the difference between absolute and fixed when considering positioning? Thanks.
@vladmp5
@vladmp5 5 жыл бұрын
the position fixed is like an absolute, but makes the div "fixed" to where you placed it, and even if you scroll down, the element won't move up. Hope i helped :)
@batucka1
@batucka1 4 жыл бұрын
Hi Kevin, great videos, thanks for everything. About this one, I have a question, how I can "activate" the links? I mean, with your example, if I want to put a link to google.com once the user click the image or text, the link doesn't work :( I was looking everywhere but with out any sucess, could you help me please?
@LawnCrack
@LawnCrack 6 жыл бұрын
Killer!!!
@fjworkshop
@fjworkshop 3 жыл бұрын
can anyone tell me why we didn't use right in the ::before and top in the ::after?
@geebee99singh
@geebee99singh 6 жыл бұрын
Sir do you have your blog or something where i can ask you designing related questions.
@KevinPowell
@KevinPowell 6 жыл бұрын
Sadly I don't. Could be something that I look into adding in the future though :)
@JimKernix
@JimKernix 3 жыл бұрын
Why is the body tag set to grid? And that the entire body is 100vh?
@KevinPowell
@KevinPowell 3 жыл бұрын
Just to center the content for the demo :)
@webcodeexplainedYT
@webcodeexplainedYT 4 жыл бұрын
How card pseudo element 'after' is getting rendered horizontal not vertical like 'before.
@Sayuiv
@Sayuiv 4 жыл бұрын
Hi Rajender, Kevin put content: " "; that make it empy and then border: 1px solid white. At first you cannot see this border because you neither give them size or starting and finishing position. Defining left:3rem and right:3rem means that you want the border start a 3rem from the left and go to the right until 3rem, than with bottom: 1.5rem it is like giving a margin. So if you want the border vertical you define top and bottom, using only left or right for the horizontal alignment. If you want it horizontal you define left and right, using top or bottom for the vertical alignment. Hope it's clear.
@webcodeexplainedYT
@webcodeexplainedYT 4 жыл бұрын
@@Sayuiv thanks for the reply. Its clear now 😌
@iancuvlad7368
@iancuvlad7368 4 жыл бұрын
Applications are countless I can mention dropdown, ripple, dialogs etc
@meew7571
@meew7571 5 жыл бұрын
I have face some problem when i use position absolute...In Every Break point the position of the content is moving.. What is the trick to position absolute content responsive in every Device
@KevinPowell
@KevinPowell 5 жыл бұрын
Other than positioning it relative to the parent, there isn't much else we can do really.
@nave3411
@nave3411 6 жыл бұрын
thanks
@KevinPowell
@KevinPowell 6 жыл бұрын
You're welcome :D
@mann3604
@mann3604 6 жыл бұрын
The class name totally depends on user right? or does card__image or card_image or cardImage or anything else makes any difference? I have seen a lot of people user _ in class names!
@KevinPowell
@KevinPowell 6 жыл бұрын
The class names are 100% your choice, you can use any name you'd like :).
@anggamxfx476
@anggamxfx476 6 жыл бұрын
Da best keep it i love ur content
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks :D
@ozzyfromspace
@ozzyfromspace 3 жыл бұрын
Ozzy Explains: why am I watching this? *1 minute in* ... font-family: “Oswald”, sans-serif; @1:00 Say no more 😭😂
@blokche_dev
@blokche_dev 6 жыл бұрын
Stylish! :)
@KevinPowell
@KevinPowell 6 жыл бұрын
Thanks!
@laPas2024
@laPas2024 6 жыл бұрын
nice
@KevinPowell
@KevinPowell 6 жыл бұрын
Glad you liked it :)
@syediqbalahmed3176
@syediqbalahmed3176 5 жыл бұрын
good
@DrinkCola
@DrinkCola 4 жыл бұрын
Dude ! We can do this card in Photoshop in a very easy way .
@jasonzhang2866
@jasonzhang2866 6 жыл бұрын
coool
@KevinPowell
@KevinPowell 6 жыл бұрын
Glad you liked it Jason :)
@justgiz
@justgiz 3 жыл бұрын
18:13 Why not just use a `right` prop? Does the exact same thing without fancy math.
The most underappreciated CSS property
9:02
Kevin Powell
Рет қаралды 70 М.
CSS position deep dive
28:14
Kevin Powell
Рет қаралды 113 М.
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН
Stop fighting with CSS positioning
21:35
Kevin Powell
Рет қаралды 93 М.
Sass Tutorial for Beginners - CSS With Superpowers
2:02:59
freeCodeCamp.org
Рет қаралды 879 М.
5 CSS mistakes that I see way too often
19:03
Kevin Powell
Рет қаралды 360 М.
CSS em and rem explained #CSS #responsive
16:54
Kevin Powell
Рет қаралды 393 М.
You can do that with margins?
14:40
Kevin Powell
Рет қаралды 189 М.
Learn flexbox the easy way
34:04
Kevin Powell
Рет қаралды 736 М.
Learn CSS Positioning Quickly With A Real World Example
8:32
Slaying The Dragon
Рет қаралды 716 М.
Learn how to create a responsive CSS grid layout
31:52
Kevin Powell
Рет қаралды 134 М.
Make position absolute work with you, not against you
10:31
Kevin Powell
Рет қаралды 27 М.
Непосредственно Каха: сумка
0:53
К-Media
Рет қаралды 12 МЛН