1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>背景色</title> <style type="text/css"> .box{ width: 400px; height: 500px; background-color: red; }
h1{ background-color: transparent; }
h2{ background-color: #FF3399; } p{ background-color: rgb(250,0,250); }
.no2{ background-color: gray; padding: 20px; }
</style> </head> <body> <div class="box"> <h1>标题2</h1> <h2>标题2</h2> <p>这是段落</p> <p class="no2">带有内边距的段落</p> </div>
</body> </html>
|