Blogger Information
Blog 11
fans 0
comment 0
visits 3151
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
选择器的应用场景
至亲难忘
Original
327 people have browsed it

选择器

上下文选择器

上下文选择器

  1. 父子选择器(标识符“>”,仅限父子使用)
    代码演示:
    1. <ul class="demo" style="border: 1;">
    2. <li class="itme1">红色</li>
    3. <li class="itme2">蓝色</li>
    4. <li class="itme3">绿色</li>
    5. <li class="itme4">粉色</li>
    6. <li class="itme5">中国
    7. <ul>
    8. <li class="itme">北京</li>
    9. <li class="itme">上海</li>
    10. <li class="itme">河南</li>
    11. <li class="itme">广州</li>
    12. </ul>
    13. </li>
    14. <li class="itme6">美国</li>
    15. <li class="itme7">韩国</li>
    16. </ul>
    17. <style>
    18. 1.<!-- 父子选择器 标识符:">"" -->
    19. .demo > .itme5{
    20. color: red;
    21. }
    22. 2.<!-- 后代选择器 标识符:"空格"" -->
    23. .demo .itme5 .itme{
    24. border: 1px solid hsl(297, 90%, 44%);
    25. }
    26. 3. <!-- 兄弟选择器 标识符:"+"" -->
    27. .demo>.itme5+.itme6{
    28. background-color: lightgreen;
    29. }
    30. 4.<!-- 兄弟选择器 标识符:"~ *" -->
    31. .demo>.itme5 ~ *{
    32. background-color: #b40c68;
    33. }
    34. </style>

父子选择器


后代选择器


兄弟选择器


所有选择器

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