The problems with viewport units

  Рет қаралды 366,665

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 415
@potrosanjuan
@potrosanjuan Жыл бұрын
I didn't know why that annoying horizontal scroll appeared, I don't know what I'd do without your videos, thank you Kevin!!!!
@Brunoenribeiro
@Brunoenribeiro Жыл бұрын
Liking the new format, Kevin! No logo splash, faster intro, going straight to the juicy content. Hope it doesn't hurt your channel's metrics! Thank you for giving it a go ❤️
@bobwilkinsonguitar6142
@bobwilkinsonguitar6142 Жыл бұрын
Devs watch KZbin on 2x speed, angrily scrolling until they find the code that fixes their bug, I'm /sure/ this is helping😂
@jasonoconner7863
@jasonoconner7863 Жыл бұрын
Wow, I was just the other night ranting about the vw units causing horizontal scroll and ChatGPT being unable to help me. Thank you!
@NotJayG
@NotJayG Жыл бұрын
you can use overflow-x: hidden; or width: 100%; instead
@studyalot596
@studyalot596 5 ай бұрын
the body element is already full width so just doing "width: 100%" always works. and yeah chatgpt is good at coding but it is not good at CSS at all for some reason..
@developerpranav
@developerpranav Жыл бұрын
100vh has been problematic for me! never had to use 100vw, but it's good to see that dvh and svh are getting support! Thanks for covering this! :D
@timseguine2
@timseguine2 Жыл бұрын
I used to do full-stack dev but quit back when IE7 support was still a thing that people sometimes had to do. I enjoy how much better things have gotten with decent html5 and css features, but my "oldschool" brain sometimes has trouble with the stuff we could never really use like this. It is great to have videos like this that distill the quirks down into manageable chunks without hours of experimentation.
@cerealrakist7360
@cerealrakist7360 Жыл бұрын
Same!!
@ongke3655
@ongke3655 Жыл бұрын
IE should be excluded from the world. Even IE10 or 11
@timseguine2
@timseguine2 Жыл бұрын
@@ongke3655 support these days is completely unnecessary. But this was coming from back in the day when it still had 10%-20% market share. Not supporting that was basically just bad business back then.
@juliapaulucci
@juliapaulucci Жыл бұрын
I JUST WANNA SAY... I LOVE YOU......... IVE BEEN SEEKING FOR THE SOLUTION OF THIS PROBLEM FOR A LONG TIME WHEN I SAW YOUR VIDEO AND BAMM!!! SOLVED!!! THANK YOU!!!!!
@FeresVocalArts
@FeresVocalArts Жыл бұрын
Man, these were the most productive 13 minutes I've been into since so long! Thank you so much!
@christian-schubert
@christian-schubert Жыл бұрын
Now, haven't been excited about a CSS topic probably since CSS grid came up - since when have 'svh' units been a thing?! (Also, how could I ever miss this?!) This LITERALLY IS a gamechanger - developing for those collapsing addressbars has always been SUCH a nuisance - thanks Kevin! 👍
@KevinPowell
@KevinPowell Жыл бұрын
They're relatively new, so do keep an eye on browser support, though it is pretty decent!
@qzbnyv
@qzbnyv Жыл бұрын
Thank you KZbin algorithm for bringing me to this amazingly useful channel 👏👏 And thanks Kevin 👏
@qzbnyv
@qzbnyv Жыл бұрын
oops though that was a top-level comment. oh well
@thedigitalceo
@thedigitalceo Жыл бұрын
It’s so sad that there’s still no real solution for 100vh on mobile. svh also doesn’t seem supported by iPhone Safari which is what our clients complain about the most.
@heyjakeay
@heyjakeay Жыл бұрын
@@thedigitalceo It works on 15.4 onwards according to CanIUse, so you could set it to 100svh and then also declare 100vh as a fallback if it isn't supported by the browser (with a padding hack as well)
@fiddle_n
@fiddle_n Жыл бұрын
I've started web dev this year (through the Odin Project, which is how I found your channel incidentally!) and Issue 2 was the bane of my life last week. What's worse is that most Google results don't include svh at all - I had to *really* look to find it. But wow is it a great unit to use.
@yarrrno
@yarrrno Жыл бұрын
This exact header 100vh issue on mobile. arghhhh. I think i asked about it like 6 months back on your discord channel. There was so little info on web about the new units. Was super happy to see this video. Now its way more clear how to make use of the new units. Truely appreciate your work, thanks in behalf of the whole world :D
@boheeatelier6681
@boheeatelier6681 10 ай бұрын
Great! I have just enrolled for the free course. I learn so much from your videos and I just love playing with CSS, so fun!
@Fowler9525
@Fowler9525 24 күн бұрын
Thank you kevin, I spent a lot of time to know the reason why I am getting that scroll bar even I used 100vw, yet you saved my time in the future.
@g-pg
@g-pg Жыл бұрын
Earlier today I was wondering how to fix a problem with an element not showing properly on mobile because of the 100vh differences between devices. Thank you very much Kevin!
@woodrunsdeep
@woodrunsdeep Жыл бұрын
I don't use vw for everything but sometimes I see people doing so. Now I'll give these people the link to this video :) Thanks Kevin!
@VivekTR
@VivekTR Жыл бұрын
I've faced many of these problems. A lot has been clarified in this video. Thank you, Kevin!
@obsessedprogrammer700
@obsessedprogrammer700 Жыл бұрын
Thanks to Kevin, now everything I say or do has 'awesome' in it.
@danielguzman8607
@danielguzman8607 Жыл бұрын
This is the first video I watch from your channel and I can say, with absolutely no doubt, that I just became your fan, man! Thanks!
@ClashRoyale-pt9zj
@ClashRoyale-pt9zj Жыл бұрын
wow, i've never known anything about that "svh" unity, it's an incredible solution for a lot of projects that could have problems like the showed on the video, thx kevin!
@dotterel
@dotterel Жыл бұрын
I literally just put this into my code, alt tabbed and saw this thumbnail, went back to my code and deleted it, then pressed play and said to myself, "don't worry, Kev, i'd never."
@joshuaheathcote2116
@joshuaheathcote2116 Жыл бұрын
I was wrestling with this the other days, so happy to hear this because now it makes sense.
@erfanvatanparasti2949
@erfanvatanparasti2949 Жыл бұрын
You are number 1 and my best teacher! 👍
@hruthikg6735
@hruthikg6735 Жыл бұрын
Wow 2 days back i was searching for this !!! 😂❤️ Great one
@andrewc95
@andrewc95 Жыл бұрын
Couldn't fall back to sleep so I've been flipping back and forth between you and Web Dev Simplified. You guys make great videos. I'll definitely have to come back to this one when I'm working on my projects.
@clebsgaming92
@clebsgaming92 Жыл бұрын
omg thank you so much for the "100svh" tip. In my case it's a sidebar which must have the exact same height as the viewport but on tablets it was having that same issue.
@dabbopabblo
@dabbopabblo Жыл бұрын
That 100vh part was very useful because I want the comment section on videos on my site to be off screen until scrolled so the comments don’t need to be loaded unless a user scrolls to see them
@ankurpathak108
@ankurpathak108 Жыл бұрын
Hey Kevin , thanks for the detailed information about View ports 😊 By the way can please explain the clamp() function in detail in a video ?
@KevinPowell
@KevinPowell Жыл бұрын
Already have one :D - kzbin.info/www/bejne/i2q5d2BqmtqsiNE
@dariokartal9453
@dariokartal9453 Жыл бұрын
What clamp() does, I used to do with calc() combined with css variables for min and max.
@corydhmiller
@corydhmiller Жыл бұрын
Hey Kevin! Nice shirt 😁🤘 just wanted to say thanks for the clearness of your videos, always find myself learning new things every time.
@frankroos1167
@frankroos1167 Жыл бұрын
So far I have only used viewport units on pages that fill the viewport exactly on regular screens, either landscape or portrait. For that use-case it works pretty well. For other use-cases I have never considered them, not because of the problems it may cause, but because the alternatives I did use came more natural. min/max/clamp are so good. And combining them with container-query-units is awesome.
@nevyanplamenov5409
@nevyanplamenov5409 Жыл бұрын
Thank you for sharing about container query units, i study responsive design right now and i had no idea those even existed...
@ichiroutakashima4503
@ichiroutakashima4503 Жыл бұрын
I thought this was a contradictory post from one of your contents, glad to learn this was kind of a continuation about dynamic viewports. I stopped using viewports and started using dynamic viewports because of your videos.
@DaleRogers
@DaleRogers Жыл бұрын
Great video. I'm investigating CSS functions now. Thanks.
@fredbcruz
@fredbcruz Жыл бұрын
Pretty on point. I liked this style
@electronicmusicartcollective
@electronicmusicartcollective Жыл бұрын
MY CSS GURU!!! THANK YOU!
@lolitukas89
@lolitukas89 Жыл бұрын
Kevin, you are a golden find
@Sanguine830
@Sanguine830 Жыл бұрын
Exactly what I needed! Thanks for this video, it’s the best
@JPNK13
@JPNK13 Жыл бұрын
Are you using something like Nvidia's Eye Contact feature? Around 1:40 your eyes suddenly change and it stood out to me. I appreciate the content either way! Thanks for uploading.
@vokhactri
@vokhactri Жыл бұрын
i also spot that weirdness
@trubnikov
@trubnikov Жыл бұрын
That was scary as shit!
@gerunkwon2598
@gerunkwon2598 3 ай бұрын
reptilian kevin
@karlo2116
@karlo2116 Жыл бұрын
Hi kevin , its really amazing that I have a problem in my code and in the NEXT DAY you make a video about my problem, happened already like 7 times
@greedyboi011
@greedyboi011 Жыл бұрын
Absolutely game changing!
@nocodekevin
@nocodekevin Жыл бұрын
I build with a mix of units and than run a PX to REM convertor before running final checks on my responsiveness. I've found that's working for me as I get more involved with Accessibility and working with multiple developers.
@ardasevinc4
@ardasevinc4 Жыл бұрын
Very helpful tips especially with 100vw. One of the points I tackle through with every project...
@pertreyu9579
@pertreyu9579 Жыл бұрын
Man this was extremely informative. I definitely have used view port values a lot in the past..
@melissabazany2363
@melissabazany2363 Жыл бұрын
Perfect timing for this, thank you, as always
@keaton718
@keaton718 Жыл бұрын
Thanks, I didn't know about dvh or svh. It's scary that Google/KZbin knew I needed to see this video...
@AbbassyProductions
@AbbassyProductions Жыл бұрын
I can see the NVIDIA Broadcast! Amazing content by the way. I do web design on the side and you have helped me so much! Thanks alot
@kdmadej
@kdmadej Жыл бұрын
For a moment I thought I was going crazy 😅
@pazdyyy
@pazdyyy Жыл бұрын
Thank you sir for the SVH value trick 👌🏻😊
@Kleyguy7
@Kleyguy7 Жыл бұрын
1:41 there is an eye glitch on Kevin face. Pretty interesting times we live in :)
@dandejy6520
@dandejy6520 Жыл бұрын
Your videos are always very helpful. 👍
@johanneswijaya5384
@johanneswijaya5384 Жыл бұрын
Thanks man! dvh saved my life
@muhamadsarhad6566
@muhamadsarhad6566 Жыл бұрын
wonderful video as always
@urbanpuma9136
@urbanpuma9136 Жыл бұрын
Straight to the point and well presented - perfect 👌
@jasonhowells7974
@jasonhowells7974 Жыл бұрын
@kevinpowell although the footer is not sticky "stays at the bottom" I use flex: 0 auto in the first div bellow the body, then once the content inside goes beyond the height it can initially display the footer will be at the bottom of the content. to me it's not good design to keep a footer in view, as it's taking up space all the time. Always appreciate your work Kevin.
@heitoreleuterio4826
@heitoreleuterio4826 Жыл бұрын
wow man, this video was exactly what I was looking for. My last project was almost 100% made with view port units. In this project it was`t a huge problem, because the target of the web site is PC/Laptops but I`m really excited to watch your course and learn the best practices. Doing layouts/UI/UX is the sort of thing that I`ve to do every day but hate every time I`m doing, and these type of video are really great to learn boring things with a dynamic explanation. thanks man =)
@kieranbarker1902
@kieranbarker1902 Жыл бұрын
Loving the Nathan Barry shirt! 👕
@emmavdev
@emmavdev Жыл бұрын
omg thank you so much, I have the problem with 100vh height in my project and the svh is probably gonna fix it!! Thank you!
@Akimb321
@Akimb321 Жыл бұрын
Regarding the 100vw producing scrollbar - I think it's not because the vw does not take into the account the scrollbar, but because (in case of body) there is already some margin applied on it. The scrollbar disappears when the margin is removed
@nervousstate
@nervousstate Жыл бұрын
This exactly too.
@calyodelphi124
@calyodelphi124 Жыл бұрын
Yeah, this. Exactly this. When sizing elements, the default behavior is to apply the sizing only to the content area, which only includes the content itself and ignores padding, borders, and margins. You can include the padding and borders in your element sizing by declaring "box-sizing: border-box;" but then that still leaves the margins left over. You have to also set "margin: 0;" and then things should work.
@Najib_Hossain
@Najib_Hossain Жыл бұрын
You're right, i used to follow and i got better results.
@andrefig822
@andrefig822 Жыл бұрын
This is only true for mobile browser/devices. Desktop 100vw DOES produce a scrollbar as of 2023. Chrome is in the works to provide a solution for that, it had a custom flag to enable overlay scrollbar until a few time ago. There's one hacky solution though: "width: calc(100vw - (100vw - 100%))", but I can see a case where you would want a 100vw instead of 100% through parent-child elements.
@haxmero4413
@haxmero4413 Жыл бұрын
Love the video 👍 A good summary of the issues and solutions that everyone should be aware of
@proffelipesilva
@proffelipesilva Жыл бұрын
Once again bringing accessibility issues. Thank you so much for this. Respect + 🤟🏻
@FernLovebond
@FernLovebond Жыл бұрын
Damn! You always teach me fascinating things, and make me want to tinker and play. Thank you for giving such clear ideas about how the various rules work. You're so awesome at this.
@GroovyMMA
@GroovyMMA Жыл бұрын
Thank you! Love your professionalism
@showingsoftwarebugs5963
@showingsoftwarebugs5963 Жыл бұрын
I use this height as a part of my css reset: html, body, #root { box-sizing: border-box; -webkit-box-sizing: border-box; margin: 0; padding: 0; font-family: Roboto, Arial, sans-serif; height: 100%; font-size: 62.5%; min-height: 100%; }
@Londonesify
@Londonesify Жыл бұрын
Are you using the AI tool for eye contact?
@tHeplAyiER
@tHeplAyiER Жыл бұрын
Haha I looked for this comment - had the same feeling xD
@KevinPowell
@KevinPowell Жыл бұрын
Was testing it out, but I've stopped cause it's a bit glitchy :D
@anuvette
@anuvette Жыл бұрын
Now that u said it, it's so uncanny and I can't unsee it anymore 😭
@harshbhardwaj6060
@harshbhardwaj6060 Жыл бұрын
It was distracting me a lot
@francescapizzighini3014
@francescapizzighini3014 Жыл бұрын
THANKS. I think I just found a great problem in my project
@jurasiks
@jurasiks Жыл бұрын
So, the guy at the start says that body & html are 100% by default, but next on 7 min he puts "height:100%" to those))
@grymmjack
@grymmjack Жыл бұрын
Thanks for the video. Subbed. I used to do a lot of web design, but haven't in ages. While things have definitely improved since those days, it's a little crazy to see the struggles with the same old problems on new tech. Will use your channel to get back up to speed. Appreciate your approach/method/sharing/pace/explanation/allthethings.
@atheisttttt
@atheisttttt Жыл бұрын
GOAT CSS Master
@skyvibe1818
@skyvibe1818 Жыл бұрын
Oh using AI eye tracking are we? 😆 Great content as always!
@Blast-Forward
@Blast-Forward Жыл бұрын
1:40?
@charlestonmiszczak5009
@charlestonmiszczak5009 Жыл бұрын
Excellent. I always want to know some solution to this problems
@shubhamsaini4871
@shubhamsaini4871 Жыл бұрын
KZbin recommend me this today. And I can't stop my finger to subscribe him.
@youngun550
@youngun550 Жыл бұрын
This is awesome. Good job Kevin. I'm very grateful for all of your excellent content!
@rproctor83
@rproctor83 Жыл бұрын
I always set my body elements to flexbox column with a min-height: 100vh, then align my footer to the bottom with the content area set as flex grow. Seems to work well.
@CoryTheSimmons
@CoryTheSimmons Жыл бұрын
Super helpful. Great channel!
@aoe2geek
@aoe2geek Жыл бұрын
This was a roller coaster of emotions for me. “Yeah this thing has problems but you can use this to fix it. But actually it has problems too so maybe try this. And actually…” 😂
@mkontent
@mkontent Жыл бұрын
Oh wow, you only just uploaded. Great video!
@vasyaqwe2087
@vasyaqwe2087 Жыл бұрын
thanks Kevin for another great video. Good to know you're telling people about your courses here too now. More people should learn from you, I feel like there's no one better in this field than you
@initiallytk
@initiallytk Жыл бұрын
Wait, are you using that NVIDIA Eye Contact thing (or something comparable) that makes your eyes look at the camera? Something's weird...
@brandonwhite5139
@brandonwhite5139 Жыл бұрын
Hello Professor KP! 😇 I am studying UX Design. Longtime artist trying to figure out front-end development. I liked your videos right away as soon as I noticed have you kept your profile in a circle frame. Plus you kept looking back towards the camera. You must be a writer. Funny thing. I watched/listened to a couple of your videos on 1.5 and 2 playback speed.
@ShaunLevett
@ShaunLevett Жыл бұрын
I do use a utility class to make panels restricted to a container look like they are full viewport width (width: 100vw; margin-left: calc(50% - 50vw). I got it from an Andy Bell tutorial. I've not seen any horizontal scroll issues though. Could just put overflow-x: hidden on parent of course. Will have to chck this, but there's no other way to do this one really.
@the-scripture
@the-scripture Жыл бұрын
good tip
@lawryyXD
@lawryyXD Жыл бұрын
This was amazing to learn about, I've just been using the h-full (100%) trick, will try out the svh way! Thanks
@dariokartal9453
@dariokartal9453 Жыл бұрын
Hella good video. Subscribed.
@udlx
@udlx Жыл бұрын
Sidenote: What's up with your camera? Check 0:31-0:38. There is a strange eye distortion going on where it almost looks like one of those Nvidia eye tracking demos gone wrong
@Its-Just-Zip
@Its-Just-Zip Жыл бұрын
I'm glad I started playing around with HTML and whatnot after svh became a thing in the standards... Learned using them from day one. And I probably use them too much
@yufgyug3735
@yufgyug3735 Жыл бұрын
for how widespread and common those problems are, it is kind of shocking that there is still no easy way to overcome those.
@junsu-ho
@junsu-ho Жыл бұрын
well height is broken since the beginning, that's why align items vertically basically doesn't work without flexbox or grid
@pelly5742
@pelly5742 Жыл бұрын
Right? It's so baffling to me that native UI elements of the browser aren't taken into account when calculating the viewport.. it just makes no sense.
@kapenike
@kapenike Жыл бұрын
@@pelly5742 learn to use height:100% properly and youll never have to worry. old web dev is better for a reason. this guy seems scared of it, must not fully understand it ... 'little issues' means even he doesnt fully understand what hes doing
@Sammysapphira
@Sammysapphira Жыл бұрын
​@@pelly5742because every browser has different native elements
@Dcookies100
@Dcookies100 Жыл бұрын
Do you use some software for your eyes? What was that at 1:40?
@nagyzoli
@nagyzoli Жыл бұрын
Literally HOW I start every CSS body { width: 100vw; height: 100vh}. I used this to force the page to stretch, so the background covers the entire screen, not leaving white space (I do not use single page that scrolls forever)
@KevinPowell
@KevinPowell Жыл бұрын
Background on body will take up full viewport already 🤔
@uimonk
@uimonk 11 ай бұрын
ur a superhero!!
@diegoavendanohernandez9908
@diegoavendanohernandez9908 Жыл бұрын
you're the man
@StevenDavisPhoto
@StevenDavisPhoto Жыл бұрын
I pretty much only use viewport units for dashboards that could be displayed on large tv's, or for setting 100% height on the page container. for the 100vw issue, you could just do overflow-x: hidden if u really needed to use it.
@gwnima1
@gwnima1 Жыл бұрын
Awesome video. Thank you.
@cabezachumbosampedro8038
@cabezachumbosampedro8038 Жыл бұрын
This is useful. Thanks.
@mdibrahimkhalil2847
@mdibrahimkhalil2847 Жыл бұрын
Thank you my dear sir
@mrtvakOnaj
@mrtvakOnaj Жыл бұрын
Thank you!!! Also your eyes creep me out, at 1:40 they're sketchy...
@KevinPowell
@KevinPowell Жыл бұрын
Haha, I'd be testing something, but I've since stopped using it 😅
@natarajanraju4198
@natarajanraju4198 Жыл бұрын
Love your content
@TheTirailleur
@TheTirailleur Жыл бұрын
I like those analytics vidéos !
@mike5904
@mike5904 Жыл бұрын
Hi Kevin, You now have around 600k more subscribers since writing the sign up page for the course 👍. Thanks for the relatable, real world content.
@jcstelt
@jcstelt Жыл бұрын
Hi Kevin, why do you declare a vw + rem als your default size in clamp? Why not just declare a somewhat larger vw? What’s the difference? Love your channel by the way!
@batchrocketproject4720
@batchrocketproject4720 Жыл бұрын
Adding the rem component allows the browser to zoom, see 10:38
@issussov
@issussov Жыл бұрын
You can use the media query or clamp with view port units too. I don't really see how your way is different
@Fragler01
@Fragler01 Жыл бұрын
This eye-contact thing sometimes make your eyes look creepy 😵‍💫
@neoweiter
@neoweiter Жыл бұрын
Very good video ! Thanks for your always great work
@VasilyPavlik
@VasilyPavlik Жыл бұрын
Thanks a lot! As usual I found your video awesome. (Gone to remove all 100vh from style.css files) :)
@michaelm8044
@michaelm8044 Жыл бұрын
Great video. Do you have an entire video on clamp and min? That would be great. Thanks!
@KevinPowell
@KevinPowell Жыл бұрын
I do! kzbin.info/www/bejne/i2q5d2BqmtqsiNE
@michaelm8044
@michaelm8044 Жыл бұрын
@@KevinPowell It was indeed a very informative video, thanks! :)
@serychristianrenaud
@serychristianrenaud Жыл бұрын
Thank 👍
CSS Tutorial In Hindi (With Notes) 🔥
8:21:02
CodeWithHarry
Рет қаралды 7 МЛН
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 180 М.
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 114 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 22 МЛН
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 72 МЛН
How to take control of Flexbox
16:01
Kevin Powell
Рет қаралды 142 М.
A new approach to container and wrapper classes
25:27
Kevin Powell
Рет қаралды 268 М.
5 super useful CSS properties that don't get enough attention
16:23
Kevin Powell
Рет қаралды 148 М.
A practical guide to responsive web design
23:13
Kevin Powell
Рет қаралды 238 М.
My top 5 most popular front-end tips
22:07
Kevin Powell
Рет қаралды 62 М.
Subgrid & Container Queries change how we can create layouts
21:08
Kevin Powell
Рет қаралды 78 М.
Avoid these 5 beginner CSS mistakes
21:38
Kevin Powell
Рет қаралды 87 М.
Please stop using px for font-size.
15:18
Coder Coder
Рет қаралды 240 М.
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Coding2GO
Рет қаралды 473 М.
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 114 МЛН