Blogger Information
Blog 15
fans 0
comment 0
visits 10889
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
常用的两种伪类选择器
P粉932932019
Original
642 people have browsed it

一、结构伪类选择器

  1. <style>
  2. .catelist{
  3. margin: 20px;
  4. }
  5. /* 结构伪类选择器 */
  6. .item:nth-of-type(2){
  7. color: red;
  8. }
  9. .item:nth-of-type(2n){
  10. background-color: rgb(227, 227, 227);
  11. }
  12. .item:nth-last-of-type(1){
  13. color: blue;
  14. }
  15. .item:nth-last-of-type(3){
  16. color: rgb(15, 241, 15);
  17. }
  18. </style>
  19. <ol class="catelist">
  20. <li class="item">item1</li>
  21. <li class="item">item2</li>
  22. <li class="item">item3</li>
  23. <li class="item">item4</li>
  24. <li class="item">item5</li>
  25. <li class="item">item6</li>
  26. <li class="item">item7</li>
  27. <li class="item">item8</li>
  28. </ol>

二、状态伪类选择器

  1. <style>
  2. /* 状态伪类选择器 */
  3. input:focus{
  4. background-color: aquamarine;
  5. border: 1px dashed gray;
  6. }
  7. input:disabled{
  8. color: red;
  9. border: none;
  10. }
  11. button{
  12. width: 150px;
  13. height: 30px;
  14. border: none;
  15. margin-bottom: 10px;
  16. background-color: greenyellow;
  17. }
  18. button:hover{
  19. background-color: red;
  20. cursor: pointer;
  21. color: #fff;;
  22. }
  23. </style>
  24. <div class="regist">
  25. <form action="check.php" method="post">
  26. <fieldset>
  27. <legend>用户注册</legend>
  28. <label>用户名:<input type="text" /></label>
  29. <label>
  30. 性别:<input type="radio" name="sex" value="1" checked />
  31. <input type="radio" name="sex" value="0" />
  32. </label>
  33. <label>
  34. 警告:<input type="text" value="一旦注册不可修改" disabled />
  35. </label>
  36. <button>提 交</button>
  37. </fieldset>
  38. </form>
  39. </div>

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