• CSS——属性选择器


    参考:https://www.codementor.io/css/tutorial/how-to-use-css-selectors

    Attribute Selectors

    1. [attr]

    eg: input[type] =>所有设置了type属性的input标签都生效(无论type的值是什么)

    2. [attr="value"]

    eg: input[type="text"]

    3.Substring Matching Attribute Selectors

    >> ^  Begin With Selector

      a[href^="http://"]

    >> $  End With Selector

      a[href$=".pdf"]

    >> *  Contains Selector

      a[href*="goo"]  包含,不区分大小写

    4. [attr~=value]

    eg:

      class="title"

      class="title colorMe"

    >> 常规 [class="title"]  完全匹配,第1个生效

    >> ~ [class~="title"]   子串匹配,1、2都生效

    >> 常规 [class="colorMe"]   完全匹配,都不生效

    >> ~ [class~="colorMe"]    子串匹配,第2个都生效

    >> 常规 [class="title colorMe"]   完全匹配,第2个生效 

    >> 常规 [class="colorMe title"]   完全匹配,都不生效

    5. [attr|=value]

    eg:

      lang="en"

      lang="en-es"

      lang="es"

    >> Selecting [lang|=en] : [lang|=en]  1、2生效(|= 对于连接符可以生效)

    >> Selecting [lang|=e] : [lang|=e]  都不生效

    >> Selecting [lang^=e] : [lang^=en]  都生效

    >> [lang|=en],[lang|=es]  都生效

    >> div[lang|=es]  第2个生效 

  • 相关阅读:
    使用eclipse新建一个SWT工程
    C++类的构造函数
    D3D编程的常见报错及解决
    D3D窗口的初始化
    C++联合体的内存使用
    QT程序如何编译
    Restart
    HTML
    信号、槽位及布局
    QT对话框程序
  • 原文地址:https://www.cnblogs.com/congyue-pepsi/p/5672815.html
Copyright © 2020-2023  润新知