Reputation: 36311
I can not get this to work, I would like the following style to only affect <ul>
elements that are NOT inside the div#canvas
element. I thought that this would work, but it doesn't.
:not(div#canvas) ul{
list-style-type: none;
padding: 0;
margin: 0;
}
So, for example the first list should NOT have bullets, while the second and third one (the ones within the div) should have bullets.
<ul>
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>
<div id="canvas">
<ul>
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>
<div>
<ul>
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>
</div>
</div>
Upvotes: 0
Views: 421
Reputation: 4564
The following selector should have worked if the :not() selector supported all possible selectors as its argument:
:not(canvas ul){
list-style-type: none;
padding: 0;
margin: 0;
}
However, as per the specification, the argument passed to the :not() selector may only be a simple selector, which is then specified here. Therefore, what you are trying to accomplish is impossible using a single css selector. The following is a little more verbose, but it would work:
ul{
list-style-type: none;
padding: 0;
margin: 0;
}
#canvas ul {
list-style-type: disc;
padding-left: 40px;
margin: 16px 0;
}
Upvotes: 1
Reputation: 1204
/*parent*/body > ul {
list-style-type: none;
padding: 0;
margin: 0;
}
this will effect immediate children (all the uls that arent nested in other divs)
OR
you could just apply a custom rule the the specific ul element you are trying to style
ul {
list-style-type: none;
padding: 0;
margin: 0;
}
div#canvas ul {
/*Custom style Here*/
}
Upvotes: 1
Reputation: 6946
This should work :
div:not(canvas) ul {
list-style-type: none;
padding: 0;
margin: 0;
}
Upvotes: 0