html - Stop overriding from previous CSS properties -
for example, given these 2 rules
p { color: red; background: yellow } p { color: green }
paragraphs appear in green text. have yellow background however, because first rule not negated. value color property overridden second rule background-color not in conflict, still applies.
so there anyway stop applying background color property?
i requiring such method because first rule may have n no. of attributes don't know beforehand. looking forward positive reply.
that's why can define classes in css.
the style defined same element overwritten if there duplicated properties , inherited previous definition same element.
try:
css
p.red { color: red; background: yellow } p.green { color: green }
html
<p class="green">some text</p> <p class="red">another text</p>
Comments
Post a Comment