开发者

CSS: Deny Attribute Selector

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜