

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Style every element that is not the specified element with CSS
To style every element that is not the specified element, use the CSS :not(selector) selector.
Example
You can try to run the following code to implement the :not selector:
<!DOCTYPE html> <html> <head> <style> p { color: red; } :not(p) { color: blue; } </style> </head> <body> <h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <p>This is a paragraph.</p> <p>This is another paragraph.</p> </body> </html>
- Related Questions & Answers
- Style every <p> element that has no children with CSS
- Style every <p> element that is the only <p> element of its parent with CSS
- Style every <p> element that is the first <p> element of its parent with CSS
- Style every <p> element that is the last <p> element of its parent with CSS
- Style every <p> element that is the nth <p> element of its parent with CSS
- Style every checked <input> element with CSS
- Style every disabled <input> element with CSS
- Style every enabled <input> element with CSS
- Style every <p> element that is the only child of its parent with CSS
- Style every <p> element that is the second child of its parent with CSS
- Style the element that has focused on CSS
- Style every <p> element that is the child of its parent, counting from the last child with CSS
- Style every <p> element with a lang attribute value with CSS
- Set a CSS style for the element when the animation is not playing
- With CSS set the element to retain the style values that is set by the first keyframe
Advertisements