1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title></title>
6 <link rel="stylesheet" type="text/css" href="style.css">
7 <link rel="stylesheet" type="text/css" href="div.css">
8 <style type="text/css">
9 h1{color:green}
10 h2{color:green !important}
11 div{border:2px blue solid}
12 </style><!--属性值若为多个单词则要加引号"",否则不能加引号。!important为强制为最高优先级-->
13 </head>
14 <body>
15 <h1 style="color: yellow">h1标题</h1><!--离内容越近的样式优先使用!-->
16 <h2 style="color: yellow">h2标题</h2>
17 <div>
18 HTML5
19 <h3>h3标签内容继承div元素样式,但类似布局样式不能继承,例外边框</h3>
20 </div>
21 </body>
22 </html>
1 @charset="UTF-8";
2 /*分号;不能省*/
3
4 h1,h2{color:red;background: blue}/*多个元素之间用逗号,多个属性之间用分号。*/
1 div{color:red;background: pink}