CSS box-sizing property

Description

CSS box-sizing property represents the box model of content. A box may include or exclude the border area as part of the box dimension.

Syntax

box-sizing : content-box | border-box

Property values

content-boxDefault

The content-box counts the content area only i.e. border is not a part of the box's dimensions.

The height and width of the box include the content and padding areas only excluding the border area.

content-box: content-box;

border-box

In this case, border-box includes the content area, padding area, and border area i.e. border is also a part of the box's dimensions.

The width and height of the border-box is the sum of content area, padding area and border area.

content-box: border-box;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 
See the box sizing model.
×

Ctrl+D