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]