zoukankan      html  css  js  c++  java
  • css选择器找亲戚

    1、first-child

    first-child表示选择列表中的第一个标签。代码如下:

    li:first-child{background:#090}

    上面的意思是,li 列表中的 第一个li模块的背景颜色。

    2、last-child

    last-child表示选择列表中的最后一个标签,代码如下:

    li:last-child{background:#090}

    3、nth-child(3)

    表示选择列表中的第3个标签,代码如下:

    li:nth-child(3){background:#090}

    上面代码中的3也可以改成其它数字,如4、5等。想选择第几个标签,就填写几。

    4、nth-child(2n) 

    这个表示选择列表中的偶数标签,即选择 第2、第4、第6…… 标签。

    5、nth-child(2n-1)

    这个表示选择列表中的奇数标签,即选择 第1、第3、第5、第7……标签。

    6、nth-child(n+3)

    这个表示选择列表中的标签从第3个开始到最后。

    7、nth-child(-n+3)

    这个表示选择列表中的标签从0到3,即小于3的标签。

    8、nth-last-child(3)

    这个表示选择列表中的倒数第3个标签。

  • 相关阅读:
    go相关
    mac下使用vscode技巧
    mac下secureCRT的使用技巧
    python subprocess实时输出
    python中多级目录导入模块问题
    python的print与sys.stdout
    python中类相关笔记
    python中sys.stdout.flush()的作用
    nginx+uwsgi配置
    虚拟机的 基本配置
  • 原文地址:https://www.cnblogs.com/ll15888/p/11858346.html
Copyright © 2011-2022 走看看