1, HTML+DIV+CSS 0 Basic Quick start to Production Enterprise Station Video course _17 CSS box model [margin calculation]

Source: Internet
Author: User

Margin

1, when two elements are on the same row, the horizontal margin between them equals the sum of the margin-left of the left element's margin-right+ right element

2, when two elements are up and down, the upper and lower margin between them equals the larger of the two elements up and down margin

3, when two elements are inclusive, the margin between them is equal to each direction of the child element margin+ the padding of the parent element of the direction

1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4     <MetaCharSet= "UTF-8">5     <title>Include relationship</title>6     <style>7 Div{8 padding:20px 40px;9 margin:20px;Ten     } One #div1{ A background:Red; -     } - #div2{ the background:Green; -     } -     </style> - </Head> + <Body> -     <DivID= "Div1"> +         <DivID= "Div2"></Div> A     </Div> at </Body> - </HTML>

1, HTML+DIV+CSS 0 Basic Quick start to Production Enterprise Station Video course _17 CSS box model [margin calculation]

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.