trex
trex

Reputation: 4047

Assign css to only p not to specific p.class

In my html page there are two type of <p> -

I want a color for the only p (should be some #xxxxx) and for p.header it should be the default color.

Here is my css:

p {
    margin-bottom:18px;
    line-height:180%;
    color:#xxxxx;
}

What I want is, this css should not get applied to p.header and it should use default style of browsers. Is there any way to select only p that are not in p.header? like

      p:not("p.header"){ 
            margin-bottom:18px;
            line-height:180%;
            color:#xxxxx;
      }

Can we also use that like, p:not(.header, .sub-title){}?

Upvotes: 0

Views: 118

Answers (2)

jpcanamaque
jpcanamaque

Reputation: 1069

 p:not(.header) { 
            margin-bottom:18px;
            line-height:180%;
            color:red;
 }

Just removed the quotation marks and the p

Fiddle here

Upvotes: 2

Mego
Mego

Reputation: 164

p:not(.header) {


 your properties
}

That should works...

Upvotes: 1

Related Questions