Blogger Information
Blog 3
fans 0
comment 0
visits 1166
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0322作业(选择器的优先级,id,class,tag); (前端组件样式模块化的原理与实现); (常用伪类选择器的使用方式,并用伪类来模块化元素组件(例如表单或列表))
Hey!Man
Original
487 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>

前端组件样式模块化的原理与实现

  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. <link rel="stylesheet" href="css/love.css">
  8. <title>前端组件样式模块化的原理与实现</title>
  9. </head>
  10. <!-- <style>
  11. @import url(css/header1.css);
  12. @import url(css/main1.css);
  13. @import url(css/footer1.css);
  14. </style> -->
  15. <body>
  16. <header align="center"><h2>如果说浑身充满力量</h2></header>
  17. <main><h2>是因为雄性激素的膨胀</h2></main>
  18. <footer align="right"><strong class="active">雄起</strong>是因为什么~~~</footer>
  19. <!-- 在根目录创建一个CSS文件夹,在里边创建3个文本header,main,footer,分装入各自的样式,
  20. 然后统一使用<link rel="stylesheet" href="css/xxx.css">调用 -->
  21. </body>
  22. </html>

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

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