CSS attribute selector class starts with but not equals to

后端 未结 2 464
死守一世寂寞
死守一世寂寞 2021-01-29 01:21

I want to apply css to all class that starts with for example \'abcd-\' but I don\'t want to apply that css to class with name for example \'abcd-dontapply\'. Can I do this?

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-29 02:03

    As mentioned in your question:

    Don't add whitespace unnecessarily. The whitespace just before the :not is significant, i.e. it changes the meaning of the selector.


    a[class^="abcd"]:not(.abcd-dontapply)
    {
        /* define CSS here*/
    }
    

    You can find all attribute selectors specifications here.

提交回复
热议问题