top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Please explain CSS box model?

+2 votes
76 views
Please explain CSS box model?
posted Feb 13, 2015 by Deepak Negi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In CSS, each of these rectangular boxes is described using the standard box model. This model describes the content of the space taken by an element. Each box has four edges: the margin edge, border edge, padding edge, and content edge.

The content area is the area containing the real content of the element. It is located inside the content edge, and its dimensions are the content width, or content-box width, and the content height, or content-box height.

If the CSS box-sizing property is set to default, the CSS properties width, min-width, max-width, height, min-height and max-height control the content size.

The padding area extends the content area with the empty area between the content and the eventual borders surrounding it. It often has a background, a color or an image (in that order, an opaque image hiding the background color), and is located inside the padding edge. Its dimensions are the padding-box width and the padding-box height.

The space between the padding and the content edge can be controlled using the padding-top, padding-right, padding-bottom, padding-left and the shorthand padding CSS properties.

The border area extends the padding area with the area containing the borders. It is the area inside the border edge, and its dimensions are the border-box width and the border-box height. This area depends of the size of the border that is defined by the border-width property or the shorthand border.

The margin area extends the border area with an empty area used to separate the element from its neighbors. It is the area inside the margin edge, and its dimensions are the margin-box width and the margin-box height.

The size of the margin area is controlled using the margin-top, margin-right, margin-bottom, margin-left and the shorthand margin CSS properties.

For More details: http://css-tricks.com/the-css-box-model/

answer Feb 13, 2015 by Amit Kumar Pandey
...