Use these instead of vh

  Рет қаралды 524,508

Kevin Powell

Kevin Powell

Күн бұрын

Пікірлер: 376
@TomasMisura
@TomasMisura 9 ай бұрын
As a casual web developer, it's challenging to keep up with all the changes and recommendations, so I'm grateful that someone like you is undertaking this and providing us with all that information.
@fersahahmet9597
@fersahahmet9597 Жыл бұрын
You are King of CSS not necessarily because you know everything but a very deep understanding of what you are talking about which i personally love and admire the most about you. Thank you Kevin for every single effort of you
@BGdev305
@BGdev305 10 ай бұрын
ditto!
@Glittery_Magic
@Glittery_Magic 10 ай бұрын
I normally ALWAYS have questions when learning. You cover all the nuances so well I have no questions only full clarity. Excellent Ive subscribed.
@arjunjayakumar4841
@arjunjayakumar4841 Жыл бұрын
The timing. I was fixing a layout and was experimenting with dvh. Will surely try out svh as well. Thanks Kevin
@ryrilya2289
@ryrilya2289 Жыл бұрын
Same here 😅
@bellion23
@bellion23 Жыл бұрын
How did it go?
@CantIllaoiThat
@CantIllaoiThat 7 ай бұрын
How did it go?
@mujahidarshad
@mujahidarshad 7 ай бұрын
bro can you tell me difference between vh, Lvh, svh and dvh.coz i am not understanding it
@Dexter101x
@Dexter101x Жыл бұрын
Just when I got to use the vh properly, lol
@Rhidayah
@Rhidayah Жыл бұрын
Me with big brain using 100%
@elpioterro
@elpioterro Жыл бұрын
I have the same situation haha
@kikevanegazz325
@kikevanegazz325 Жыл бұрын
The guy is a developer - streamer, not the CSS god who is commanding you something. If 100vh that’s working for you and you do it right, keep it up.
@rokoderechte
@rokoderechte Жыл бұрын
Well its the same thing anyways
@marvellousgboun6068
@marvellousgboun6068 11 ай бұрын
😂
@bossaddict08
@bossaddict08 Жыл бұрын
You know what, your content is a step above most other channels regardless of content type. Keep doing what you do please. I think you're excellent.
@houssembenothmen7250
@houssembenothmen7250 Жыл бұрын
svh is not just better u have to do it as for the performance tests you will always find the CLS (cumulative layout shift) and definetly the dvh may cause problem there in tests
@Hataken999
@Hataken999 Жыл бұрын
The timing couldn't be more perfect. I was creating a "Coming Soon" page and when I was working on the mobile version, the footer and hamburger menu sidebar were overflowing with 100vh. I was stuck trying to find a solution, but then I came up with a dynamic vh solution using JavaScript, and it worked really well (even though it took me almost 3 hours to figure it out). And now you post a video, showing me a super simple way to fix it 😂😂
@EvgenyOrekhov
@EvgenyOrekhov Жыл бұрын
Even better: use dvb/svb/lvb. These are called "logical units", and they will respect the writing mode. "b" stands for "block", which is the dimension perpendicular to the flow of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes.
@msweblearner
@msweblearner Жыл бұрын
Thanks
@tebesvet
@tebesvet 11 ай бұрын
It's just a different use case, I assume? The video describes a situation when you need an element with 100% height of viewport.
@matt42hughes
@matt42hughes 11 ай бұрын
why would you want any element to be 100% height with horizontal writing mode but 100% width when it’s vertical. isn’t that what respecting the writing mode would do?
@jaimemartin1932
@jaimemartin1932 Жыл бұрын
I just started using dvh to avoid some issues, and now I discover that svh is even better. Thanks.
@deliriumcode
@deliriumcode Жыл бұрын
Believed or not - one of your most powerful videos. Short and sorts a years of problems. :)
@kopilkaiser8991
@kopilkaiser8991 5 ай бұрын
You are the best tutor in teaching CSS. The one reason being you explain in detail and help to understand better the properties and their use cases :D
@mfurkankaya
@mfurkankaya Жыл бұрын
When I saw the thumbnail, I thought this is absolutely clickbait. What could be better then vh? But this is really great!
@Wynorrific1
@Wynorrific1 Жыл бұрын
Great content, you helped me learn HTML, CSS and, SCSS. I'm now learning JavaScript. Have a blessing day.
@hariskhan2454
@hariskhan2454 Жыл бұрын
Amazing Man... I just had an issue and from 100vh went to 95vh for Mobile view, but now I think I'll use svh for mobile view !
@abhishek_23685
@abhishek_23685 5 ай бұрын
1:09 DVH - Dynamic 2:26 SVH - Smallest 3:11 LVH - Largest
@truthteachers
@truthteachers Жыл бұрын
Thanks
@KevinPowell
@KevinPowell Жыл бұрын
Thank you so much!
@ManishBajagai
@ManishBajagai 5 ай бұрын
Luckily and accidentally i used svh through vs code suggestions, and it fixed the issue i had with the vh in mobile screens. I didn't really knew what svh was back then but i was super pumped up to see that it worked like a charm
@a1white
@a1white Жыл бұрын
Useful! Looks like I’ll be switching my vh to svh from now on. Thanks
@worthsalive
@worthsalive Жыл бұрын
I think applying transition on the Hight property will take care of the jumps in with dvh. It will be cool if the jump is rather a smooth stretch.
@miro_h2o
@miro_h2o Жыл бұрын
My No.1 channel for CSS content!
@isurus0
@isurus0 Жыл бұрын
omg, someone who actually taught me something i didn't know, thanks kev!
@gabydewilde
@gabydewilde Жыл бұрын
Welcome to another episode of new units to work around issues with old units but have issues of their own. Of course you could also use: bottom but I get that that isn't the point of the exercise. We kinda needed a new way to make pages jump up and down now that most of the old methods have been fixed.
@Lumiden
@Lumiden 10 ай бұрын
Not really, these units were just not necessary before mobiles started having a dynamic height.
@truthteachers
@truthteachers Жыл бұрын
Love all the short hints and help from you, bro. Shor, simple nd extremely helpful. Keep them coming. I try to give back something whenever i can.
@moonchildCZ
@moonchildCZ Жыл бұрын
Thanks Kevin. I had this exact problem and I just skipped it, because I couldn't find the perfect solution. Now this video showed up to me and it's so easy :)
@aceenterprise
@aceenterprise Жыл бұрын
Thank you, I have dealt with the vh problem quite a bit, and didn't know about the new dimensions.
@JuanMoisesTorrijos
@JuanMoisesTorrijos Жыл бұрын
I have been using dvh and didn't realize that it was causing the layout shift, I guess I will be using svh instead. Thanks for the video.
@andreasorourke4252
@andreasorourke4252 Жыл бұрын
I'm getting into freelance development and your channel is super helpful!
@DrunkenUFOPilot
@DrunkenUFOPilot Жыл бұрын
I had no idea about vh, never mind dvh, svh, lvh. Very clear explanations and demo! I would subscribe, except I'm already subscribed :)
@StephenMoreira
@StephenMoreira Жыл бұрын
God such great content I need to support you like yesterday.
@gbonariva
@gbonariva Жыл бұрын
@KevinPowell, in case you are short of ideas for new videos, I would like to understand how you manage the Cumulative Layout Shift (CLS) issues that occur by adding to the page some dynamic elements, fonts, s, etc.
@silent_syntax
@silent_syntax Жыл бұрын
If you are talking about dynamic elements that are loading when the page loads, you could use skeleton loaders like KZbin does to make up for the space they will take once they fully show up. :)
@degagnemarc
@degagnemarc Жыл бұрын
Oh ya! Did I struggle with this a while ago till I found those units. Thanks for the reminder.
@mefesto_
@mefesto_ Жыл бұрын
I tried to use 100dvh, but my clients don't like to see layout jump when scrolling the page. I will try to use 100svh :) Nice video!
@confused_horse
@confused_horse Жыл бұрын
Apparently it's already supported more than 98% by now. Really comes in handy to know about it right now. Working on my first mobile application.
@martinlottering9048
@martinlottering9048 10 ай бұрын
Thanks for the easy to understand explanation. I used to think these concepts would just be out of reach for me. 🎉 I struggle a bit with html and css. I think it is because I started with winforms and then later xaml.
@deankinyua2365
@deankinyua2365 11 ай бұрын
you help us so much Powell ........wish i had financial means to support you☺☺☺
@TysonBrady
@TysonBrady 7 ай бұрын
I used svh, dvh and lvh for a project a few months ago and during user testing had complaints from everyone using Apple devices because they weren't working properly (like not at all). Never again, at least not for a few years.
@МухамметКурбаназаров
@МухамметКурбаназаров Жыл бұрын
Life saving. I was having headache with it. Thank you soooooo much❤
@refeals
@refeals Жыл бұрын
love how they made it super trivial to solve a problem that was super annoying to handle
@stefan5673
@stefan5673 Жыл бұрын
Thank you for your Videos
@TheBoysMemes123
@TheBoysMemes123 10 ай бұрын
I was suffocating but after adding dvh instead of vh it works and love from my heart
@guevarraerick
@guevarraerick Жыл бұрын
This is awesome! Solves mobile browser UI overlaps
@SolidWorksMastery-hr4sg
@SolidWorksMastery-hr4sg 9 ай бұрын
Fun Fact : the :D sign or emoji (in the chrome toolbar) instead of numbers it mean like there is already more than 99+ tab opened funny that Kevin too have the habit of not closing tabs XD..........sometimes i make it change to this emoji ;) if in incognito but i don't know the number
@simonchainbers8943
@simonchainbers8943 2 ай бұрын
I used 100svh in my code and it completely broke my site, spent hours looking for an error only to realise the problem was right infront of me (100svh), these view port units are not supported by all browsers especially old browsers. Fixed it by putting 100vh as a fall back.
@colindante5164
@colindante5164 Жыл бұрын
This is awesome!!! Way better than using calc(100vh - computed height of UI element ). Thanks ))
@katlegomonama5824
@katlegomonama5824 Жыл бұрын
We having that CSS convo , About that time!
@pibbz13
@pibbz13 Жыл бұрын
After you mentioned this svh in an earlier video, i've been in love with it ever since. It's now a staple in all my projects 👍
@long_codes
@long_codes Ай бұрын
Thank you for explanation, 0:57
@kuan-weihuang5214
@kuan-weihuang5214 3 ай бұрын
Thank you, you solved my problem. really helpful. I wish you a good day.
@pagarevijayy
@pagarevijayy 10 ай бұрын
good one. i didn't even know this existed. no time to catchup. thanks for this!
@igordasunddas3377
@igordasunddas3377 Жыл бұрын
I love your videos, Kevin! You're my goto when I want to learn new things about CSS.
@iam_spaceCabbage
@iam_spaceCabbage Жыл бұрын
I just spent a few hours today working on this exact issue and suddenly i find this in my feed, the algorithm is pranking me
@fifthscholar
@fifthscholar Жыл бұрын
For me this is useful in media queries since you've mentioned that vh doesn't have problem on desktops but only on mobile view
@twentytwoalchemy
@twentytwoalchemy 10 ай бұрын
Thanks for sharing. Im new to your channel and really enjoy your teaching style.
@gargola1754
@gargola1754 11 ай бұрын
very useful info, thank you Kevin
@nztchris8024
@nztchris8024 9 ай бұрын
He is just like a gold mine but for CSS stuff! Great videos!
@septimusforster
@septimusforster Жыл бұрын
Mr KP! Awesome, always.
@saptarshimondal7021
@saptarshimondal7021 Жыл бұрын
Awesome Explanation! Loved It...
@daviderichsen9267
@daviderichsen9267 11 ай бұрын
I like to use an outer element with 100vh to prevent page to shift height, and then use an inner element with 100dvh to adjust the for objects placement in the wiewport.
@NaniwaRocky
@NaniwaRocky Жыл бұрын
Hey Kevin, an important question! I haven't seen many CSS guru's on YT tackle this problem and so I am wondering if it is only me that encounters it. I have noticed that most people over the age of 45+ tend to have their windows system set to a zoom of 125% or 150%, this zoom tends to break the original style defined for the site when viewed at a normal zoom of 100%. How do you handle these situations ? I mainly use TailwindCSS for my styling, I don't know if it is a specific problem of TailwindCSS where the class uses pixels instead of rem and such... My only solution up till now is to generate a special media query for these 125 and 150 zoom cases and define a rule to zoom out a bit so it looks more faithful to the original design. Many thanks for your genius content!!! (example: @media (-webkit-device-pixel-ratio: 1.25) { * { zoom: 0.99; } })
@parves
@parves Жыл бұрын
You don't necessarily need a specific zoom media query. If you use relative properties and appropriately implement media queries for different sizes, zoom effects can be minimized, if not entirely mitigated. It's important to note that zooming primarily alters the appearance by making the screen pixel size appear larger or smaller. For instance, on my Full HD monitor, the viewport width is normally 1920px. However, at 110% zoom, it becomes 1745px, at 125% it's 1536px, and at 150%, it resembles a HD monitor with 1280px width. So, if you've got those media queries set up for different screen sizes, they should still work fine, even when someone zooms in or out.
@NaniwaRocky
@NaniwaRocky Жыл бұрын
Thanks for the good explanation! :)@@parves
@sharjeelfaiq16
@sharjeelfaiq16 Жыл бұрын
You've fixed my life. Thanks a lot.
@MightBeRasor
@MightBeRasor Жыл бұрын
I'm building websites with different sections that need to be as tall as the viewport and there are a lot of scroll-based animations. Whenever there is a layout shift it can get pretty laggy because the libraries need to recalculate everything to the new scroll position. I've tried some approaches, but I found that using 100lvh is interesting because the section will always cover the viewport and, with the animations, all the extra height at the bottom of the section is barely noticeable. Anyone have a better alternative?
@christian9540
@christian9540 Жыл бұрын
Not sure what you are doing and what you need, but if you want to make full page containers and stick to that even on resize, you can simply just use something anchor like to see what anchor is next to you and scroll to it. Use windows resize and awrtimeout + cleartimeout method to actually delay it to not constantly recalculate on resizing. Make the delay to something like 100ms and then get your current position. Iterate through your predefined anchors and request their position. If you notice being between two anchors you can define a percentage breaking point when to the scroll up or down. You can use the values here but they will change instantly. If you want a certain amount of delay or only resize them after window resizing finished, use css variables and fill them by js on windows resize, use settimeout and cleartimeout to add a delay. With var(--var, 100vh) you can also let it work initially and it will be resized very shortly after loading. If you want to reduce the time cause your application takes a moment when loading, you can use cookies to store the value. So when you load site you can check if there this cookie, access it and actually use that as the initial value as well. But if you application is that slow, maybe optimizing it is better than adding another workaround.
@keenoogodlike
@keenoogodlike Жыл бұрын
Best CSS teacher.
@nathanconlon738
@nathanconlon738 Жыл бұрын
Wow, this is perhaps *the* most helpful video I've seen on CSS. I'm currently building a UI for my university and the vh was an annoying issue. I'd resorted to something like calc(100vh - 170px) for the height, but I can see that svh is much better. Thank you!
@afrographixstudio
@afrographixstudio Жыл бұрын
you could have used javascript. by setting your div height equals to -- window.innerHeight+"px" --
@kristofgheyssens3941
@kristofgheyssens3941 7 ай бұрын
Will certainly try this out. Have been using 95vh or so for mobile to fix this, but it's a bit unpredictable.
@bevik12
@bevik12 Жыл бұрын
Great content and a big plus for the Star Wars + the 'too many' tabs in Chrome.😁
@Credi6464
@Credi6464 Жыл бұрын
I used dvh in one of my projects, it was my first time using it, when i saw the scrolling in mobile i had no idea what was happening, took me some time to discover the issue was being caused by this dynamic heights, and yeah, svh solved the issue
@gunnercat8045
@gunnercat8045 6 ай бұрын
actually, sometime this problem happen on desktop, for example when you have a horizontal scrollbar, and then you set the height to 100vh, it will have this problem
@requindr
@requindr 5 ай бұрын
Sadly dvh is bugged on Chrome Android when you make a fullscreen request when the browser header isn’t already visible. It makes the content height even larger than 100vh because it adds the browser header’s height once more in fullscreen when it isn’t supposed to.
@RideTheTeacups
@RideTheTeacups Жыл бұрын
This is BRILLIANT. Thank you!
@rand0mtv660
@rand0mtv660 Жыл бұрын
Recently dvh was useful to me for a fixed collapsed menu on mobile. There is no layout shift there because the element is a fixed menu and when I was using vh, bottom of the menu would get cut off in certain cases because of browser UI pushing it down. Using dvh it worked in all cases as I wanted it so that was nice.
@v4ldevrr4m47
@v4ldevrr4m47 Жыл бұрын
New suscriber, this video or the tittle in this one catch my attention . And Later Here you are! Great content
@evansvibetv1237
@evansvibetv1237 Жыл бұрын
I would love to see more videos of javascript from your contents... I love your teachings.
@3ventic
@3ventic Жыл бұрын
Interesting that looking at the demos on firefox iOS, all of them function identical to how you'd expect dvh to function. Initially it's all visible, like dvh or svh, and once the URL bar disappears, there's a layout shift. On all of them.
@RidingWithJake
@RidingWithJake Жыл бұрын
God I've been struggling with this with one component for weeks on firefox iOS. I'm tempted to just throw some JS at it at this point, but if anyone has a work around in CSS I'm all ears.
@s34n2
@s34n2 Жыл бұрын
@@RidingWithJake There is no workaround with CSS as of now, it has been an issue for over 10 years, as recorded in the Firefox bug tracker. The only way is to use a CSS variable updated with JavaScript but you have to make sure to update it only when the height of the page is increased only, not decreased, then you'd just be recreating the issue.
@brunoais
@brunoais Жыл бұрын
I wish dvh had been created the way I proposed it (which even had scrollbars logic built-in) and not the downgraded version they ended up implementing. I also had specified that unless battery saving options were active, the adaptation should be animated. I guess the "should" was taken with it's permissibility of "not". Downgrade being: It doesn't take scrollbars into account while in my specification, it must and I even specified the algorithm...
@tehoko
@tehoko Жыл бұрын
I'm definitely going to be using lvh for one thing: full-page background images. With vh or dvh they'll get resized, which isn't a desirable side effect of scrolling. With lvh the image will always stay the same size.
@seobookpro
@seobookpro Жыл бұрын
Anyway Everyone can do they own way of CSS - The Dev Tool is way to test and see what's new and what values and units are included and supported by your Browser Inspect Tool. Especially for CSS - when you type your new or select class or id hit the Tab and you will see all available values for the CSS attribute you want to edit, change or check.
@cachogames
@cachogames 11 ай бұрын
Great content like always
@ahooton
@ahooton Жыл бұрын
I've just tested this out in my current project... Indeed, for most things, svh seems to work better on mobile than dvh. The one exception is for my background overlay effect, which covers the mobile viewport more accurately when set to dvh.
@rameenana
@rameenana 9 ай бұрын
Thanks man. This was helpful.
@IhorVyshniakov
@IhorVyshniakov Жыл бұрын
Really usefull rules, thank you for informing about these new features of CSS
@sebastianestrada1311
@sebastianestrada1311 Жыл бұрын
Interesting useful information about css. Thanks a lot.
@ashawesomeone
@ashawesomeone Жыл бұрын
it just feels so dumb that browser mobile app devs didn't even realize that those moving address bars can absolutely ruin viewport heights
@kryptonaut_
@kryptonaut_ Жыл бұрын
Oh my god. I was having this exact issue with fenagling vh on a static site that doesn't scroll but fills the viewport, instantly fixed with one extra letter lmao thank you based css god
@dominicdomingo9654
@dominicdomingo9654 11 ай бұрын
Omg having troubles with this kind of problem THANK YOU BIG SO VERY MUCH!!
@mlizano6793
@mlizano6793 6 ай бұрын
this is very usefull, thanks for te information, greetings from Costa Rica, Pura Vida! ✌
@ahmaddeveloper-n1m
@ahmaddeveloper-n1m Жыл бұрын
i love you Kevin Powell you are great
@vouagiaz
@vouagiaz Жыл бұрын
omg, an actually useful video! thanks!
@SashenMe
@SashenMe Жыл бұрын
Thanks for addressing my question!
@azzazkhansiddiqui
@azzazkhansiddiqui Жыл бұрын
Thanks man you saved my day.
@Manas-co8wl
@Manas-co8wl Жыл бұрын
I was just going to use vh then I saw this. Thanks again
@minor12828
@minor12828 Жыл бұрын
Css G sharing the rules 🙌💥💥
@ichiroutakashima4503
@ichiroutakashima4503 Жыл бұрын
I've always used dvh, never heard of the other two, until now.
@shadyheadstash
@shadyheadstash Жыл бұрын
This has been huge for web GIS applications since they are typically full screen.
@DayrateNiterate
@DayrateNiterate 3 ай бұрын
Really cool I’m gonna try.
@sharkinahat
@sharkinahat Жыл бұрын
There's also svmin, lvmin, and dvmin, as well as svmax, lvmax, and dvmax... Thanks Mr-Who-Invented-The-Auto-Hide-Address-Bar '-_-
@PacificDev
@PacificDev Жыл бұрын
Love your sweatshirt and the video, of course!
@AlThePal78
@AlThePal78 Жыл бұрын
Wow I didn't know or realize there was others besides dvh I thought it was only dvh and vh thanks :)
@aleattorium
@aleattorium Жыл бұрын
ohhh this could be a nice css puzzle to post about
@MrJettann
@MrJettann Жыл бұрын
Kevin, I have a question for you, will this fallback work if I use it inside calc function? Or for this purpose I have to use @supports directive and inside of it use my calc?
@christian9540
@christian9540 Жыл бұрын
Fallbacks works if your input is invalid. As long it is invalid it uses the previous value. Actually I am not sure why you are even asking this. You can test your question in a few seconds...
Avoid These 5 Awful CSS Mistakes
20:42
Kevin Powell
Рет қаралды 199 М.
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
I Redesigned the ENTIRE YouTube UI from Scratch
19:10
Juxtopposed
Рет қаралды 942 М.
The problems with viewport units
13:23
Kevin Powell
Рет қаралды 369 М.
CSS-Only Page Transitions That Will BLOW Your Mind!
4:13
Hemant Dutta
Рет қаралды 7 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 844 М.
2 better alternatives to overflow: hidden
11:04
Kevin Powell
Рет қаралды 162 М.
My top 5 most popular front-end tips
22:07
Kevin Powell
Рет қаралды 70 М.
Tmux has forever changed the way I write code.
13:30
Dreams of Code
Рет қаралды 1 МЛН
Please stop using px for font-size.
15:18
Coder Coder
Рет қаралды 248 М.
23 CSS features you should know (and be using) by now
31:31
Kevin Powell
Рет қаралды 83 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 157 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН