:not(p) {
color: #ff0000;
}
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<div>This is some text in a div element.</div>
<a href="https://www.w3schools.com" target="_blank">Link to W3Schools!</a>
The not(selector)
is used to select every element that is not specified element, So in the above code i am getting red color on both p
which is a non-selected item.
I am expecting only div
,a
,h1
to be red, not p
as p
is a specified element and it is meant to be leave and style have to apply to all others element?