CSS attribute selector class starts with but not equals to

后端 未结 2 466
死守一世寂寞
死守一世寂寞 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 01:57

    You can do that with proper css selectors: starts with selector would be like-

    div[class^="abc"]:not([class="abc2"])
    

    I have a sample jsfiddle for you: http://jsfiddle.net/8w65ffj0/1/

提交回复
热议问题