CSS regex selector match one OR another condition?

后端 未结 2 929
有刺的猬
有刺的猬 2021-01-02 04:46

I\'d like to match when /(\\sclassName|^className)/ is satisfied, but when selecting css. Hypothetically I would use like:



        
2条回答
  •  臣服心动
    2021-01-02 05:18

    You'll need to use two separate selectors with the same rule. CSS selectors don't really support alternation.

    [class^='icon-'], [class*=' icon-'] {
      /* ... */
    }
    

    div {
      color: red;
    }
    
    [class^='icon-'], [class*=' icon-'] {
      color: green;
    }
    should match
    should match
    should not match

提交回复
热议问题