Blogger Information
Blog 31
fans 2
comment 0
visits 27825
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
上下文选择器
霏梦
Original
636 people have browsed it

- 作者:霏梦

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>上下文选择器</title>
  7. <style>
  8. /* 后代选择器 空格表示 */
  9. .h3-title div {
  10. border: 1px solid lightskyblue;
  11. }
  12. /* 父子选择器 > 没有孙子的份*/
  13. /* body div { */
  14. /* border: 5px solid coral; */
  15. /* } */
  16. /* 这样写 */
  17. body > div {
  18. border: 5px solid coral;
  19. }
  20. /* 同级相邻选择器 */
  21. .wsp.center + .wsp {
  22. background-color: lightgreen;
  23. }
  24. /* 同级所有选择器 */
  25. .wsp.center ~ .wsp {
  26. background-color: magenta;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="h3-title">
  32. <div class="wsp" id="first">我是第1行</div>
  33. <div class="wsp">我是第2行</div>
  34. <div class="wsp">我是第3行</div>
  35. <div class="wsp">我是第4行</div>
  36. <div class="wsp center">我是第5行</div>
  37. <div class="wsp">我是第6行</div>
  38. <div class="wsp">我是第7行</div>
  39. <div class="wsp">我是第8行</div>
  40. <div class="wsp">我是第9行</div>
  41. </div>
  42. </body>
  43. </html>
Correcting teacher:WJWJ

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