Undo/cancel/revert a style declaration

Hi,

Is it possible to ‘cancel’ a style declaration using CSS? I realise the question is vague, so here’s an example:

I have a CSS file containing the following rules (obviously this isn’t my actual problem!)


p { color: white }
span { color: red }

and some HTML that looks like this:


<p>I am in white <span>but I am in red</span></p>

I am not allowed to change the CSS file as it is locked down by a software vendor, so all I can do is embed style rules in the page. What I want to do is cancel the span rule so that the text now picks up the paragraph rule instead and all the text is white. The thing is, the supplied CSS file might be changed by the vendor and the paragraph colour declaration could change to green instead of white, so I don’t just want to put

span {color: white; }

in my embedded style.

Is this sort of thing possible?

Many thanks,

Andrew

Try span {color: inherit; } :slight_smile:

That works great, thanks very much. I wasn’t expecting it to be that simple :slight_smile:

span { color:white } would have worked too.

One of the beauties of CSS is that if you declare the same value again, it overrides the previous declaration… which is why source-order and load-order are so important.

Right up until the point where p {color:white;} was changed to p {color:green;} … then the span is still white rather than taking the same colour as the paragraph.