Box Model, Box Model

Source: Internet
Author: User

Box Model, Box Model

CSS + DIV

Encapsulate data into a div. The page consists of a lot of Divs. these divs are stored through css layout (through css attribute layout). a div is a box.

Border :{

-- Left

-- Right

-- Top

-- Bottom

};

# Div_1 {

Border-top: 1px solid # ccc;

Border-bottom: 1px dashed # ccc;

Border-right: 1px dotted # ccc;

Border-left: 1px double # ccc;

};

Solid: solid line

Dashed: dotted line

Dotted: dot line

Double: double Line

 

Padding/padding

Attribute: padding {

-- Top

-- Bottom

-- Right

-- Left

};

Padding: 20px 20px 20px 20px;

 

Margin

Margin property {

-- Top

-- Bottom

-- Right

-- Left

};

Margin: 20px 20px 20px 20px

In div, if the value of margin is 0 or px, why should it be blank? The gap is the distance between the body and the browser border.

So you need to set the body {margin: 0px };

The browser parses the body in different ways, resulting in different width and width of the side.

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.