Use these instead of vh

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 374

  • @TomasMisura
    @TomasMisura 8 หลายเดือนก่อน +17

    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 ปีที่แล้ว +443

    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 9 หลายเดือนก่อน

      ditto!

  • @Glittery_Magic
    @Glittery_Magic 8 หลายเดือนก่อน +9

    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 ปีที่แล้ว +165

    The timing. I was fixing a layout and was experimenting with dvh. Will surely try out svh as well. Thanks Kevin

    • @ryrilya2289
      @ryrilya2289 ปีที่แล้ว +1

      Same here 😅

    • @bellion23
      @bellion23 ปีที่แล้ว

      How did it go?

    • @CantIllaoiThat
      @CantIllaoiThat 6 หลายเดือนก่อน

      How did it go?

    • @mujahidarshad
      @mujahidarshad 5 หลายเดือนก่อน

      bro can you tell me difference between vh, Lvh, svh and dvh.coz i am not understanding it

  • @Dexter101x
    @Dexter101x ปีที่แล้ว +523

    Just when I got to use the vh properly, lol

    • @Rhidayah
      @Rhidayah ปีที่แล้ว +38

      Me with big brain using 100%

    • @elpioterro
      @elpioterro ปีที่แล้ว +5

      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 ปีที่แล้ว +5

      Well its the same thing anyways

    • @marvellousgboun6068
      @marvellousgboun6068 10 หลายเดือนก่อน

      😂

  • @jaimemartin1932
    @jaimemartin1932 11 หลายเดือนก่อน +4

    I just started using dvh to avoid some issues, and now I discover that svh is even better. Thanks.

  • @houssembenothmen7250
    @houssembenothmen7250 ปีที่แล้ว +66

    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

  • @EvgenyOrekhov
    @EvgenyOrekhov ปีที่แล้ว +136

    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 10 หลายเดือนก่อน +1

      Thanks

    • @tebesvet
      @tebesvet 10 หลายเดือนก่อน +4

      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 10 หลายเดือนก่อน +3

      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?

  • @Hataken999
    @Hataken999 ปีที่แล้ว +5

    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 😂😂

  • @bossaddict08
    @bossaddict08 ปีที่แล้ว +23

    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.

  • @kopilkaiser8991
    @kopilkaiser8991 3 หลายเดือนก่อน

    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

  • @ManishBajagai
    @ManishBajagai 3 หลายเดือนก่อน

    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

  • @hariskhan2454
    @hariskhan2454 ปีที่แล้ว +2

    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 !

  • @mfurkankaya
    @mfurkankaya ปีที่แล้ว

    When I saw the thumbnail, I thought this is absolutely clickbait. What could be better then vh? But this is really great!

  • @deliriumcode
    @deliriumcode ปีที่แล้ว +3

    Believed or not - one of your most powerful videos. Short and sorts a years of problems. :)

  • @a1white
    @a1white ปีที่แล้ว +1

    Useful! Looks like I’ll be switching my vh to svh from now on. Thanks

  • @abhishek_23685
    @abhishek_23685 4 หลายเดือนก่อน

    1:09 DVH - Dynamic
    2:26 SVH - Smallest
    3:11 LVH - Largest

  • @Wynorrific1
    @Wynorrific1 ปีที่แล้ว +2

    Great content, you helped me learn HTML, CSS and, SCSS. I'm now learning JavaScript. Have a blessing day.

  • @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.

  • @gabydewilde
    @gabydewilde ปีที่แล้ว +6

    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 8 หลายเดือนก่อน +1

      Not really, these units were just not necessary before mobiles started having a dynamic height.

  • @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.

  • @martinlottering9048
    @martinlottering9048 9 หลายเดือนก่อน

    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.

  • @miro_h2o
    @miro_h2o ปีที่แล้ว

    My No.1 channel for CSS content!

  • @aceenterprise
    @aceenterprise ปีที่แล้ว

    Thank you, I have dealt with the vh problem quite a bit, and didn't know about the new dimensions.

  • @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 :)

  • @TheBoysMemes123
    @TheBoysMemes123 8 หลายเดือนก่อน

    I was suffocating but after adding dvh instead of vh it works and love from my heart

  • @daviderichsen9267
    @daviderichsen9267 10 หลายเดือนก่อน

    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.

  • @mefesto_
    @mefesto_ ปีที่แล้ว +1

    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!

  • @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

  • @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.

  • @worthsalive
    @worthsalive ปีที่แล้ว +4

    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.

  • @degagnemarc
    @degagnemarc ปีที่แล้ว

    Oh ya! Did I struggle with this a while ago till I found those units. Thanks for the reminder.

  • @isurus0
    @isurus0 11 หลายเดือนก่อน

    omg, someone who actually taught me something i didn't know, thanks kev!

  • @fifthscholar
    @fifthscholar 11 หลายเดือนก่อน

    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

  • @SolidWorksMastery-hr4sg
    @SolidWorksMastery-hr4sg 8 หลายเดือนก่อน +1

    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

  • @truthteachers
    @truthteachers ปีที่แล้ว +1

    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.

  • @andreasorourke4252
    @andreasorourke4252 ปีที่แล้ว +3

    I'm getting into freelance development and your channel is super helpful!

  • @deankinyua2365
    @deankinyua2365 9 หลายเดือนก่อน

    you help us so much Powell ........wish i had financial means to support you☺☺☺

  • @tehoko
    @tehoko ปีที่แล้ว +5

    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.

  • @kristofgheyssens3941
    @kristofgheyssens3941 6 หลายเดือนก่อน

    Will certainly try this out. Have been using 95vh or so for mobile to fix this, but it's a bit unpredictable.

  • @refeals
    @refeals 11 หลายเดือนก่อน +1

    love how they made it super trivial to solve a problem that was super annoying to handle

  • @ahooton
    @ahooton ปีที่แล้ว +4

    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.

  • @katlegomonama5824
    @katlegomonama5824 ปีที่แล้ว +1

    We having that CSS convo , About that time!

  • @iam_spaceCabbage
    @iam_spaceCabbage ปีที่แล้ว +1

    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

  • @colindante5164
    @colindante5164 ปีที่แล้ว

    This is awesome!!! Way better than using calc(100vh - computed height of UI element ). Thanks ))

  • @guevarraerick
    @guevarraerick 11 หลายเดือนก่อน

    This is awesome! Solves mobile browser UI overlaps

  • @kuan-weihuang5214
    @kuan-weihuang5214 2 หลายเดือนก่อน

    Thank you, you solved my problem.
    really helpful. I wish you a good day.

  • @МухамметКурбаназаров
    @МухамметКурбаназаров ปีที่แล้ว

    Life saving. I was having headache with it. Thank you soooooo much❤

  • @gbonariva
    @gbonariva ปีที่แล้ว +6

    @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 11 หลายเดือนก่อน +1

      If you are talking about dynamic elements that are loading when the page loads, you could use skeleton loaders like TH-cam does to make up for the space they will take once they fully show up. :)

  • @StephenMoreira
    @StephenMoreira ปีที่แล้ว +2

    God such great content I need to support you like yesterday.

  • @bevik12
    @bevik12 ปีที่แล้ว

    Great content and a big plus for the Star Wars + the 'too many' tabs in Chrome.😁

  • @pagarevijayy
    @pagarevijayy 9 หลายเดือนก่อน

    good one. i didn't even know this existed. no time to catchup. thanks for this!

  • @brunoais
    @brunoais ปีที่แล้ว +2

    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...

  • @TysonBrady
    @TysonBrady 6 หลายเดือนก่อน +1

    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.

  • @unknownmale
    @unknownmale ปีที่แล้ว +1

    Still prefer the JS route personally, All the advantages of SVH plus you can animate if needed, update on scroll or not. But glad there is more support for this issue. So many years of hacks and work arounds!
    let vh = window.innerHeight * 0.01;
    document.documentElement.style.setProperty('--vh', `${vh}px`);

  • @keenoogodlike
    @keenoogodlike 10 หลายเดือนก่อน

    Best CSS teacher.

  • @dominicdomingo9654
    @dominicdomingo9654 9 หลายเดือนก่อน

    Omg having troubles with this kind of problem THANK YOU BIG SO VERY MUCH!!

  • @evansvibetv1237
    @evansvibetv1237 ปีที่แล้ว +4

    I would love to see more videos of javascript from your contents... I love your teachings.

  • @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 :)

  • @nathanconlon738
    @nathanconlon738 11 หลายเดือนก่อน +1

    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 11 หลายเดือนก่อน

      you could have used javascript. by setting your div height equals to -- window.innerHeight+"px" --

  • @stefan5673
    @stefan5673 ปีที่แล้ว +5

    Thank you for your Videos

  • @saptarshimondal7021
    @saptarshimondal7021 ปีที่แล้ว

    Awesome Explanation! Loved It...

  • @gargola1754
    @gargola1754 10 หลายเดือนก่อน

    very useful info, thank you Kevin

  • @twentytwoalchemy
    @twentytwoalchemy 8 หลายเดือนก่อน

    Thanks for sharing. Im new to your channel and really enjoy your teaching style.

  • @septimusforster
    @septimusforster 11 หลายเดือนก่อน

    Mr KP! Awesome, always.

  • @sharjeelfaiq16
    @sharjeelfaiq16 11 หลายเดือนก่อน

    You've fixed my life. Thanks a lot.

  • @rand0mtv660
    @rand0mtv660 ปีที่แล้ว +8

    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.

  • @nztchris8024
    @nztchris8024 7 หลายเดือนก่อน

    He is just like a gold mine but for CSS stuff! Great videos!

  • @pibbz13
    @pibbz13 ปีที่แล้ว +2

    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 👍

  • @sharkinahat
    @sharkinahat ปีที่แล้ว +1

    There's also svmin, lvmin, and dvmin, as well as svmax, lvmax, and dvmax... Thanks Mr-Who-Invented-The-Auto-Hide-Address-Bar '-_-

  • @ashawesomeone
    @ashawesomeone ปีที่แล้ว +1

    it just feels so dumb that browser mobile app devs didn't even realize that those moving address bars can absolutely ruin viewport heights

  • @RideTheTeacups
    @RideTheTeacups ปีที่แล้ว

    This is BRILLIANT. Thank you!

  • @Danielo515
    @Danielo515 ปีที่แล้ว

    Yeah, exactly what I wanted. Rather than fixing the original (kind of new) property just introduce 5 new more

  • @IhorVyshniakov
    @IhorVyshniakov 11 หลายเดือนก่อน

    Really usefull rules, thank you for informing about these new features of CSS

  • @Human_Evolution-
    @Human_Evolution- ปีที่แล้ว +1

    Only took 2 years for someone to post this solution. I spent a week on this 2 years ago. Never found a solution.

  • @markmuggeridge5797
    @markmuggeridge5797 7 หลายเดือนก่อน

    Thanks, good to know it wasn't only me that was getting that 'mini-jump' on scroll, thanks - phew!

  • @spaceflightquack
    @spaceflightquack 8 หลายเดือนก่อน

    You are a miracle, i just ran in this problem

  • @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

  • @ichiroutakashima4503
    @ichiroutakashima4503 ปีที่แล้ว +1

    I've always used dvh, never heard of the other two, until now.

  • @mlizano6793
    @mlizano6793 4 หลายเดือนก่อน

    this is very usefull, thanks for te information, greetings from Costa Rica, Pura Vida! ✌

  • @sebastianestrada1311
    @sebastianestrada1311 11 หลายเดือนก่อน

    Interesting useful information about css. Thanks a lot.

  • @simonchainbers8943
    @simonchainbers8943 18 วันที่ผ่านมา +1

    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.

  • @shadyheadstash
    @shadyheadstash ปีที่แล้ว

    This has been huge for web GIS applications since they are typically full screen.

  • @SashenMe
    @SashenMe ปีที่แล้ว

    Thanks for addressing my question!

  • @aleattorium
    @aleattorium ปีที่แล้ว

    ohhh this could be a nice css puzzle to post about

  • @DayrateNiterate
    @DayrateNiterate 2 หลายเดือนก่อน

    Really cool I’m gonna try.

  • @justinoneill2837
    @justinoneill2837 ปีที่แล้ว

    OMG thank you. been trying to find hacks around this for years

  • @gunnercat8045
    @gunnercat8045 5 หลายเดือนก่อน

    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

  • @rameenana
    @rameenana 8 หลายเดือนก่อน

    Thanks man. This was helpful.

  • @igordasunddas3377
    @igordasunddas3377 ปีที่แล้ว

    I love your videos, Kevin! You're my goto when I want to learn new things about CSS.

  • @kbzcomuy
    @kbzcomuy 11 หลายเดือนก่อน

    muy bueno gracias, yo luché con eso, cambiando por js el 100vh por min-height

  • @PacificDev
    @PacificDev 11 หลายเดือนก่อน

    Love your sweatshirt and the video, of course!

  • @hstrinzel
    @hstrinzel 9 หลายเดือนก่อน

    WOW, VERY GOOD! I needed that already years ago! Thank you! Is there some way how to affect FONT SIZE (e.g. much LARGER FONTS on much smaller devices?), or on portrait vs landscape?

  • @cambsdigital
    @cambsdigital 10 หลายเดือนก่อน

    I am reminded of developing SPA's must be 15 years ago now as a creative person the frustration that mobile brings was brought back. But not all bad...developing flash for 800x600 or 1024x768 wow did I just remember those dims off by heart? (not edited)

  • @ahmaddeveloper-n1m
    @ahmaddeveloper-n1m 11 หลายเดือนก่อน

    i love you Kevin Powell you are great

  • @Shub-Dev07
    @Shub-Dev07 ปีที่แล้ว +1

    Now, Some videos are gonna pop up on YT with title 'Ten CSS tips you don't know' and I am pretty sure svh will be in it

  • @cachogames
    @cachogames 10 หลายเดือนก่อน

    Great content like always

  • @azzazkhansiddiqui
    @azzazkhansiddiqui ปีที่แล้ว

    Thanks man you saved my day.

  • @rusul.994
    @rusul.994 11 หลายเดือนก่อน

    Oh ,thank you so much .. i was suffering from this problem❤

  • @shohelrana-dev
    @shohelrana-dev ปีที่แล้ว

    I am searching for this solution. thank you.