pstein Posted November 6, 2013 Share Posted November 6, 2013 (edited) 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 November 6, 2013 by pstein Link to comment Share on other sites More sharing options...
Ingolme Posted November 6, 2013 Share Posted November 6, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now