CSS rule with ID or class exception

Is there any way with css to set a style that will affect all instances of an html element except those of a particular class or ID? For example, giving all paragraphs <p> a 10px margin except for those with a 'nomargin' id <p id="nomargin">?
Jonathan GreenbergAsked:
Who is Participating?
 
dincaflorinCommented:
I think the sollution is to set the class with margin 10px for all <p> elements, and for those particular <p class="nomargin"> set the class with margin 0 px. (and don't use multiple elements with the same id, use the same class)
Hope it helps
0
 
Jonathan GreenbergAuthor Commented:
I understand. So I guess there's nothing like

p (!.nomargin) {
   margin:10
}

Right? No way to specifically tell a rule to ignore a certain class or ID?
0
 
dincaflorinCommented:
yes, that's correct
0
 
Jonathan GreenbergAuthor Commented:
Okay, thanks for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.