CSS Box Model
CSS box model describes how elements are visually laid out on the web pages.
What is Box Model
Every element that can be displayed is comprised of one or more rectangular boxes. CSS box model typically describes how these rectangular boxes are laid out on a web page. These boxes can have different properties and can interact with each other in different ways, but every box has a content area and optional surrounding padding, border, and margin.
The following diagram demonstrates how the padding, border, and margin CSS properties determines how much space an element can take on a web page.
Width and Height of Elements
Usually when you set the width and height of an element using the CSS
height properties, in reality you are only setting the width and height of the content area of an element. The actual width and height of the element's box depend on several factors.
The actual space that an element's box might take is calculated like this:
|Box Size||CSS Properties|
Explanation of the different properties given in the upcoming chapters.
Note: In CSS box model; content area of the element's box is the area, where text, images, lists, tables, forms, videos, etc. appears.