90-100 CSS 设置不同元素的背景颜色
<head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> h1 { background-color: indigo; } div { background-color: khaki; } p { background-color: lightcoral; } </style> </head> <body> <h1>css案例 background-color </h1> <div> 该文字内容插入在div元素中 <p>给这个段落设置了属于自己的背景颜色</p> 我们仍然在同一个div元素标签中 </div> </body>
效果