3_css选择器的优先级.html 675 B

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. div{
  10. background: red;
  11. }
  12. #div1{
  13. background: green;
  14. }
  15. .aa{
  16. background: blue;
  17. }
  18. /* css选择器的优先级
  19. style > id选择器> class选择器 >标签选择器
  20. 1000 100 10 1
  21. */
  22. </style>
  23. </head>
  24. <body>
  25. <div id="div1" class="aa" style="background:orange">1111</div>
  26. </body>
  27. </html>