Not css

Testing class and id selector combinations with not keyword for css

by Checha Man

HTML

<h1>This is a heading</h1>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

<div id="soma" class="mangla">This is some text in a div element.</div>

<div id="soma">Soma id</div>
<div class="mangla">Mangla class</div>

<a href="http://www.w3schools.com" target="_blank">Link to W3Schools!</a>

<ul>
  <li>A</li>
  <li id="different">B</li>
  <li>C</li>
</ul>

CSS

p {
    color: #000000;
}

:not(p) {
    color: #ff0000;
}
#soma.mangla {
    color: #00ff00;
}

li:not(#different) {
  font-size: 3em;
}