Understanding LVH, SVH and DVH units with CSS

Find out all about LVH, SVH and DVH units in CSS, new units that enable you to create responsive interfaces adapted to all screen sizes.
•
Updated on August 14, 2026
•
5 min read
Believemy logo

With mobile devices of all sizes being released every year, it has become increasingly complicated to properly address various needs.

If you have already made a site responsive (adapted to screen sizes), you know what I mean! 😁

Fortunately, Dynamic Viewport Units like svh, lvh, and dvh have entered the front-end developer's arsenal to easily create dynamic responsive designs.

  • svh (Small Viewport Height) - This means that 1svh corresponds to 1% of the visible area when the browser controls are visible (like the navigation bar)
  • lvh (Large Viewport Height) - This means that 1lvh corresponds to 1% of the visible area when the browser controls are hidden
  • dvh (Dynamic Viewport Height) - This means that 1dvh corresponds to 1% of the visible viewport height, automatically switching from lvh to svh depending on whether the controls are visible or not

Let's take a detailed look at these units! But first, let's start by understanding what the viewport really is.

 

What is the Viewport?

The viewport is simply the visible area of a web page in a browser: it's where we see a website load.

In fact, it's not uncommon to use one of these two important units to work with the viewport:

  1. vh (Viewport Height)
  2. vw (Viewport Width)

These two units allow you to specify that 100vh, for example, corresponds to the entire height of the browser, and thus, we often use it to display an image as soon as a visitor arrives on our website.

CSS
.main {
    background-image: url(...);
    background-size: cover;
    height: 100vh;
}

However, with all the new mobile devices, screen sizes have become numerous.

Whether with elements like navigation bars or virtual keyboards, the size of the viewport is no longer the same for everyone.

This is where the svh, lvh, and dvh units can help us.

 

CSS Units SVH, LVH, and DVH

CSS Unit SVH (Small Viewport Height)

This CSS unit is based on the viewport size when the buttons are visible. In other words, it represents the smallest height that the viewport can reach.

It allows us to avoid surprises by anticipating scenarios where the space is reduced (think of your navigation bar that appears or shrinks when using Safari on iOS 😉).

 

CSS Unit LVH (Large Viewport Height)

The lvh unit corresponds to the maximum height of the viewport even if buttons might temporarily reduce part of this height: for example, the navigation bar or "full-screen" mode.

It is very useful for setting elements under the assumption that the available size is maximum.

 

CSS Unit DVH (Dynamic Viewport Height)

There is a small problem with the SVH and LVH units: one allows styling based on whether the buttons are visible (SVH) and the other based on whether the buttons are invisible (LVH).

Therefore, you have to make a choice between:

  • creating a design based on the assumption that the buttons are visible
  • or creating a design based on the assumption that the buttons are invisible

We would like to create a dynamic design: one that is 100% of the viewport height when the buttons are visible and at the same time 100% of the viewport height when the buttons are invisible.

Good to know

In short, we want to somewhat forget about our buttons and focus on the page itself.

Obviously, you can use the dvh unit for that.

It's the most flexible of the three. It dynamically represents the entire viewport height:

  • If the buttons are displayed - 100dvh = 100% of the visible page height in the viewport
  • If the buttons are not displayed - 100dvh = 100% of the visible page height in the viewport minus the size of the buttons
Good to know

100dvh ultimately corresponds to the height of the page, regardless of whether the buttons are visible or not.

 

Summary Table between vh, lvh, svh, and dvh

Let's recap the main differences between these 4 CSS measurement units.

CSS UnitDescription
vhRepresents the height of the viewport without considering whether buttons are visible or not
svhRepresents the minimum height of the viewport (as if the buttons were visible)
lvhRepresents the maximum height of the viewport (as if the buttons were invisible)
dvhRepresents the dynamic height of the viewport, so 100dvh does not equal the same number of pixels depending on whether the buttons are visible or not

 

And in terms of compatibility, what does it look like?

These CSS units are quite recent, and not all browsers are compatible yet.

You can check at any time which browser can read or cannot read these units on caniuse.

Example with the CSS unit dvh
Example with the CSS unit dvh

As we can see, the dvh unit is compatible with all browsers except Internet Explorer (which is expected...) and Firefox (which is really very surprising, however).

 

Conclusion

The lvh, svh, and dvh units are very interesting! They make it easy to control the behavior of elements in responsive designs.

However, be careful because these last ones are not yet very compatible with the most used browsers like Firefox.

Question

That's all very interesting, but if I want to go further? 😇

You can take a look at our dedicated training on HTML and CSS! It's guaranteed to be the most comprehensive!

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

A short guide to units of measurement with CSS

Units of measurement... What a great subject! A subject that can be a little confusing when you're just starting out, but which is of paramount importance when you're embarking on your projects. In this short guide, we'll look at everything you need to know about units of measurement in CSS.

December 6, 2024

How can you use CSS variables to make everything more dynamic?

Perhaps you've already had that moment when you wanted to change the main colour of one of your projects? Or perhaps you've already experienced those moments when you go back to retrieve the colours of your site's theme? It's all very time-consuming and impractical. Thanks to CSS variables, this will be a thing of the past! Let's find out how.

December 9, 2024

The complete Flexbox CSS guide

Are you learning how to use Flexbox? Looking for a way to use Flexbox with CSS? Don't know how Flexbox works? Welcome to the complete Flexbox CSS guide!

December 5, 2024

Creating a sinking button with CSS

The buttons on a site are the main triggers for action: styling them and making them dynamic is very important in your development process! That's the aim of this article.

December 9, 2024

Create hover text on image with CSS

We've already seen how to create an element that is displayed when the mouse hovers over an image, but in this article we'll show you how to display a whole host of information very fluidly by hovering the mouse over an element!

December 9, 2024

All about the new :is() and :where() selectors in CSS

Let's take a look at the latest selectors offered by CSS: where and is! These selectors will allow us to reduce our code and select our elements more flexibly.

December 9, 2024

Create an "architectural" design button using CSS

Creating a button where the borders split in two on hover may seem complicated, but nothing could be easier! Let's find out how in this article.

December 9, 2024

Make an arrow that expands when hovered over with CSS

Whether it's to make your users want to see your project, read your article or access a page on your website, presenting your link with an arrow will make it easier to catch your visitors' eye! Let's find out in this article how to animate this arrow to enhance your readers' experience.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.