Blogger Information
Blog 10
fans 0
comment 0
visits 4858
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1020 css权重和选择器作业
onbind
Original
363 people have browsed it

代码实例

  1. <style>
  2. /*权重为0 0 1*/
  3. li{
  4. color: red;
  5. }
  6. /*权重为0 1 1*/
  7. li.item{
  8. color: red;
  9. }
  10. /*权重为1 1 1*/
  11. li.item#two{
  12. color: red;
  13. }
  14. /* 提升权重 */
  15. /* 权重为1 1 2 */
  16. ul li.item#two{
  17. color: blue;
  18. }
  19. /* 此时第一个li元素的颜色为orange色 */
  20. /* ul li:first-of-type{
  21. color: orange;
  22. } */
  23. /* 此时第二个li元素的颜色为orange色 */
  24. /* ul li:nth-of-type(2){
  25. color: orange;
  26. } */
  27. /* 此时最后一个li元素的颜色为orange色 */
  28. /* ul li:last-of-type{
  29. color: orange;
  30. } */
  31. /* 此时第2,4,6...的li元素为orange色 */
  32. /* ul li:nth-of-type(2n){
  33. color: orange;
  34. } */
  35. /* 此时所有li元素都为orange色 */
  36. /* ul li:nth-of-type(n + 1){
  37. color: orange;
  38. } */
  39. /* 此时从每三个li元素开始,都为orange色 */
  40. /* ul li:nth-of-type(n + 3){
  41. color: orange;
  42. } */
  43. /* 此时从第三个元素开始,每隔一个li元素都为orange色 */
  44. /* ul li:nth-of-type(2n + 3){
  45. color: orange;
  46. } */
  47. /* 此时前三个li元素为orange色 */
  48. ul li:nth-of-type(-n + 3){
  49. color: orange;
  50. }
  51. </style>
  52. <ul>
  53. <li class="item">item1</li>
  54. <li class="item" id="two">item2</li>
  55. <li class="item">item3</li>
  56. <li class="item">item4</li>
  57. <li class="item">item5</li>
  58. <li class="item">item6</li>
  59. <li class="item">item7</li>
  60. <li class="item">item8</li>
  61. </ul>
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