/ 状态伪类:当选择得目标对象状态发生改变后,进行什么样的样式设置 /

  1. .list > li.first{
  2. color: blueviolet;
  3. }
  4. .list > li:nth-of-type(1){
  5. color: brown;
  6. }
  7. .list > li:nth-of-type(5){
  8. color: brown;
  9. }
  10. /*
  11. :nth-of-type(an+b)
  12. 1 a:系数,[0,1,2,3...]
  13. 2 n:参数,[0,1,2,3...]
  14. 3 b:偏移量,从0开始
  15. */
  16. /* 匹配一个 */
  17. /* 0*n+5 */
  18. .list > li:nth-of-type(5){
  19. color: brown;
  20. }
  21. /* 匹配一组 */
  22. .list > li:nth-of-type(1n+3){
  23. background-color: blueviolet;
  24. }
  25. .list > li:nth-of-type(-1n+3){
  26. background-color: blue;
  27. }
  28. .list > li:nth-of-type(2n){
  29. background-color: green;
  30. }
  31. /* 前3个 */
  32. .list > li:nth-of-type(-n+3){
  33. background-color: aquamarine;
  34. }
  35. /* 后3个 */
  36. .list > li:nth-last-of-type(-n+3){
  37. background-color: antiquewhite;
  38. }
  39. /* 第一个 */
  40. .list > li:first-of-type{
  41. }
  42. /* 最后一个 */
  43. .list > li:last-of-type{
  44. }
  45. /* 奇偶 even:偶数 */
  46. .list > li:nth-of-type(even){
  47. background-color: red;
  48. }
  49. /* 奇偶 odd:偶数 */
  50. .list > li:nth-of-type(odd){
  51. background-color: green;
  52. }
  53. /* 结构性伪类:选择子元素去使用的 */
  54. /* 设置被禁用元素样式 */
  55. input:disabled{
  56. color: blue;
  57. }
  58. button:hover{
  59. background-color: blue;
  60. }
  61. input.a +{
  62. background-color: blue;
  63. }
  64. input:focus{
  65. background-color: blue;
  66. }

更多相关文章

  1. Android柱状图-柱子分组
  2. 第一章:android串口开发so库生成
  3. 伪类选择器:元素匹配过程
  4. 如何判断一个点在地图上?如何判断一个点在多边形内?
  5. Android串口开发,基于官方的android-serialport-api增加支持设置
  6. python利用while求100内的整数和方式
  7. PHP算法练习九:将全部偶数转到全部奇数之前
  8. 1. box-sizing属性解决了什么问题?2. 伪类选择器的参数 an+b的经
  9. 给定一个数组筛选其偶数成员组成新的数组返回

随机推荐

  1. Android修行之路——Android程序设计基础
  2. 在 ubuntu10.04下 载 android源码 步骤
  3. android默认属性
  4. android设置按钮背景透明度与设置布局背
  5. android:launchMode="singleTask" 与 onN
  6. Android大图轮播-学习笔记
  7. Android Studio与HttpClient
  8. Android程序有很多Activity,在B中如何关闭
  9. Android App 如何动态加载类
  10. android 使用基站 wifi定位