how do I select a div with class “A” but NOT with class “B”?

前端 未结 3 1020
悲&欢浪女
悲&欢浪女 2021-02-06 20:14

I have some divs:

\"Target\"
\"NotMyTarget\"
\"NotMyTarget\"<
3条回答
  •  后悔当初
    2021-02-06 20:43

    I think the best you can do (until CSS 3) is override the styles in this case with what you don't want from class A B in A, like this:

    .A.B { /* Styles */ }
    .A { /* Reverse any styling you don't want */ }
    

提交回复
热议问题