Categories
CSS

How to set 100% height with padding/margin with CSS?

Spread the love

Sometimes, we want to set 100% height with padding/margin with CSS.

In this articl, we’ll look at how to set 100% height with padding/margin with CSS.

How to set 100% height with padding/margin with CSS?

To set 100% height with padding/margin with CSS, we set the box-sizing property.

For instance, we write

div {
  box-sizing: border-box;
}

to make the div stay the same size after adding padding.

Conclusion

To set 100% height with padding/margin with CSS, we set the box-sizing property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *