I want to add a border to every div that doesn't have the bar class:
HTML
<div class="foo bar">010101</div>
<div class="foo">010101</div>
<div class="foo bar">010101</div>
<div class="foo">010101</div>
<div>010101</div>
CSS
div {
background: #ffcc00;
height: 50%;
margin: 10px 0;
padding: 10px;
width: 50%;
}
Elements with bar class should not be styled. I need to use some attribute selector. Are there any attribute selector to do that?
UPDATE:
Fixed using :not() In my case: "div:not(.bar) {"
Thanks.
Try this out:
div[class!="bar"] {
//CSS HERE
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.