How to fix 100% height not expanding the div’s height to the screen height with CSS?

Spread the love

Sometimes, we want to fix 100% height not expanding the div’s height to the screen height with CSS.

In this article, we’ll look at how to fix 100% height not expanding the div’s height to the screen height with CSS.

How to fix 100% height not expanding the div’s height to the screen height with CSS?

To fix 100% height not expanding the div’s height to the screen height with CSS, we use 100vh.

For instance, we write

body {
  height: 100vh;
}

to set the body element’s height to 100vh to make it fill the height of the tab.

Conclusion

To fix 100% height not expanding the div’s height to the screen height with CSS, we use 100vh.

Leave a Reply

Your email address will not be published.