1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Title</title>6 </Head>7 <Body>8 <!--The first way to add CSS styles, add the Style property to the tag -9 <Divstyle= "background-color:blue; width:100px; height:100px">I'm the first piece.</Div><BR>Ten <Divstyle= "background-color:red; width:100px; height:100px">I'm the second piece.</Div><BR> One </Body> A </HTML>
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Title</title>6 <style>7 . C1{8 Background-color:Red;9 width:100px;Ten Height:100px; One } A </style> - </Head> - <Body> the <!--the second way to add CSS styles is to add the Class property - - <Divclass= "C1">I am the red</Div><BR> - </Body> - </HTML>
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Title</title>6 <!--the third way to add CSS styles is to use CSS files -7 <Linkrel= "stylesheet"href= "C1.css">8 </Head>9 <Body>Ten <Divclass= "C1">I'm pink.</Div><BR> One </Body> A </HTML>
C1.css file is
1 . C1 {2 background-color: pink; 3 width: 100px; 4 height:100px; 5 }
HTML tags _ add CSS style