What is the box model in CSS?

The creation and design of the site is a complex and time-consuming process. Or block the box model in CSS describes the boxes which are generated for HTML elements. Furthermore, in such models there are detailed options to define the scope, field and fill the content of each element. The block model is one of the fundamental concepts of layout. If to speak normal language, this means that all elements of the HTML document displayed in its own rectangular block. This unit consists of content directly to internal content, margins, borders, and of course, external padding. To control each of these parts in the CSS are there appropriate property, namely: border — the border margin – the external padding, padding – padding.

What is the difference between external and internal margins?

Everything is very simple. The main difference is that margin is the space between the border and outer design, and padding explicitly, the distance between the hosted content and the border. If to draw an analogy, the padding is the same field on paper, they are the same color as the sheet, but the text on them does not go. But margin is the distance between the edge of one sheet and the sheet lying next to him.

I would also like to remind you about what are the types of block models. They can be supported by all popular browsers is a model from the W3C, as well as traditional, lE6 supported in backward compatibility mode.

Leave a Comment

Your email address will not be published. Required fields are marked *