Course Content

If you are facing any issue in playing video please use Firefox browser.

Course Content


What Is Negation Pseudo Class And Where To Use It In CSS3?

Suppose we have taken a parent or class. In that, there are four class. So in total five class; there is one different element and other four are same. Assume that all four same class is are of A name and different class is of B name.

Let’s see Example of Negation Pseudo class for this case :
First we have to make a class in HTML :
<div class= “negation”>
<p class= “sc”> same class</p>
<p class= “sc”> same class</p>
<p class= “dc”> different class</p>
<p class= “sc”> same class</p>
Now define negation in CSS for paragraph tag as shown :
.p: not(.sc) {color: red;}

After saving, you will see in browser, all same class text are of black color and different class is of red color. When you require to apply same style to so many sections but in that, you want one or two sections to be different, use this negation pseudo class.


Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere