Box Model, Box Model

Source: Internet
Author: User

Box Model, Box Model
Box Model Overview

The box model is one of the cornerstones of CSS. It specifies how elements are displayed and (to some extent) how they interact. Each element on the page is regarded as a rectangle frame, which consists of the content, inner margin, border, and outer margin of the element ,:

The padding, border, and outer margin are optional. The default value is 0, but many elements are set by the user proxy style sheet (Browser style, you can use the universal selector to explicitly set the padding and padding to 0 to overwrite the Browser style:

* {Margin: 0; padding: 0 ;}

The padding appears around the content area. If you add a background to an element, Beijing will apply to the area composed of content and padding. the padding is usually used to create an isolation band, so that the content will not be mixed with the background; the border will add a line to the outside of the internal margin. These lines can be of various styles, such as truthful lines and live dotted lines; the outer margin is the outer margin and the outer margin is transparent. It is usually used to control the interval between elements. Width and Height indicate the Width and Height of the content area. When margin or padding is set, the size of the entire element box is changed.

 

Overlay margin

Only common elements and non-floating elements are allowed.

1. when two or more vertical margins meet, the margins they form are not the sum of the bottom margins of the above elements and the top margins of the following elements, but the two margins have a larger value ,:

2. When the child element's top and bottom margins match the parent element's top and bottom margins, an extra margin with a large margin value will also be formed ,:

3. If the content of an element is empty, the upper and lower margins will also overlap ,:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.