Jump to content

Exclude of elements with certain IDs possible?


pstein

Recommended Posts

Assume I have the following html:<div id="aaa"> <p id="bbb">...</p> <p id="ccc">...</p> ...text outside of a p.... <p id="ddd">...</p> <p>...</p> <p style="...">...</p></div>How can I assign a CSS style to all <p> without an id (here: the last two)?

 

2nd,related question: Assume I want to exclude only <p> with id="ccc": How can I achieve this?

Peter

Edited by pstein
Link to comment
Share on other sites

There aren't any exclusion selectors. The most you can do is select all <p> elements inside #aaa and then override that style with the ones that have IDs:

#aaa p {    color: green;}#bbb, #ccc, #ddd {    color: inherit;}

Excluding #ccc:

#aaa p {    font-weight: bold;}#ccc {    font-weight: normal;}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...