Blogger Information
Blog 52
fans 1
comment 1
visits 38659
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演示选择器的优先级,id,class,tag
小丑0o鱼
Original
420 people have browsed it
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  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>1. 实例演示选择器的优先级,id,class,tag;</title>
  8. <style>
  9. /* 选择器 + 声明块 = 样式规则 */
  10. /* 在样式的优先级相同情况下,书写顺序决定优先级 写在后面的样式会覆盖前面的样式*/
  11. /* 选择器本身优先级大于书写顺序 */
  12. #first .active{
  13. color: tomato;
  14. }
  15. h1 {
  16. color: red;
  17. }
  18. h1 {
  19. color: violet;
  20. }
  21. .active {
  22. color: teal;
  23. }
  24. #first {
  25. color: tomato;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <h1 class="active" id="first">
  31. 初次(美好的邂逅),爱···需要遇见,初次···需要呵护~~~
  32. </h1>
  33. </body>
  34. </html>
  35. 前端组件样式模块化的原理与实现
  36. <!DOCTYPE html>
  37. <html lang="zh-cn">
  38. <head>
  39. <meta charset="UTF-8">
  40. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  41. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  42. <link rel="stylesheet" href="css/love.css">
  43. <title>前端组件样式模块化的原理与实现</title>
  44. </head>
  45. <!-- <style>
  46. @import url(css/header1.css);
  47. @import url(css/main1.css);
  48. @import url(css/footer1.css);
  49. </style> -->
  50. <body>
  51. <header align="center"><h2>如果说浑身充满力量</h2></header>
  52. <main><h2>是因为雄性激素的膨胀</h2></main>
  53. <footer align="right"><strong class="active">雄起</strong>是因为什么~~~</footer>
  54. <!-- 在根目录创建一个CSS文件夹,在里边创建3个文本header,main,footer,分装入各自的样式,
  55. 然后统一使用<link rel="stylesheet" href="css/xxx.css">调用 -->
  56. </body>
  57. </html>

实例演示常用伪类选择器的使用方式,并用伪类来模块化元素组件(例如表单或列表)

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post