1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>CSS Control DIV Display</title>6 <styletype= "Text/css">7 #header8 {9 width:200px;Ten Height:100px; One Background-color:Red; A font-size:20px; - } - #footer the { - width:200px; - Height:100px; - Background-color:Green; + } - Div + { A width:400px; at Height:300px; - font-size:40px; - Background-color:Purple; - } - </style> - </Head> in <Body> - <DivID= "header"> to I am Header; + </Div> - <DivID= "Content"> the I am Content; * </Div> $ <DivID= "Footer">Panax Notoginseng I am Footer; - </Div> the </Body> + </HTML>
The effect is as follows:
Note: When the div is distinguished by ID, the CSS control must precede the ID name with "#";
About the precedence of CSS Control div: The finer the scope of control, the higher the priority level;
The greater the scope of control, the lower the priority level;
HTML Learning Note 3--css Control div display Exercises