Menu Close

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

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.

Posted in CSS