The CSS box model is a container that contains multiple properties including borders, margin, padding and the content itself. With the help of this box-model, you can create the design and layout of web pages. This can be used as a toolkit for customizing the layout of different elements.
The web browser provides every element as a rectangular box according to the CSS box model.
Box-Model has the following properties in CSS.
borders
margins
padding
Content
Border Area: This area contains in between the box’s padding and margin. Its dimensions are given by the width and height of the border.
Margin Area: The space between the border and margin is a margin area. Its dimensions are given by the width and height of the margin-box.
Padding Area: It defines the element’s padding. This area is actually the space around the content area and within the border-box. Its dimensions are given by the width and the height of the padding-box.
Content area: This area contains content like text, image, etc. The dimensions are given by content-box width and height.
Normally, when you set the width and height of an element using the CSS width and height properties, then, you are only setting the width and height of the content area of an element.
The actual element’s box width and height depend on several factors.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok