How to use box-sizing property in CSS?

The box-sizing property tells the browser what the sizing properties should include. We can set this property to content-box (default) or border-box.

The box-sizing property is used to include the padding and border in an element’s total width and height.

Ex:-

div { box-sizing: border-box;}

content-box-

The width and height properties (and min/max properties) include only the content. Border, padding, or margin are not included.

border-box-

The width and height properties (and min/max properties) include content, padding, and border, but not the margin.

box-size property usually uses in cards, images & fonts.

Tagged : / / / /