March 9th, 2004, 07:56 PM
CSS Question: Is this legit / supported / compliant?
I'm wondering if duplicate / overriding directives are allowed in the CSS Spec.
Here's an example:
will the second call to background-color override the first and be drawn as white?
<div style="background-color: black; background-color: white">
it may sound stupid, but i'm writing a PHP class that outputs CSS and I don't want to have to do pattern matching to make sure that the user inputted tag isn't already set. I want to just append it.
March 9th, 2004, 08:27 PM
i know it's not legit and i think it could cause problems bij some browsers rejecting the css
March 9th, 2004, 08:35 PM
The CSS validator at w3c.org does not return an error nor a warning when you re-declare a style like you have.
Explain your problem instead of asking how to do what you decided was the solution.
March 9th, 2004, 08:39 PM
i thought i read somewhere a long time ago about the proper way to override a style by re-declaration, but i think it had something to do with using linked style sheets and embedded sheets in the header. It didn't mention anything about doing it inline like I have here.
March 9th, 2004, 10:14 PM
Hello, old friend...
March 11th, 2004, 11:54 AM
i came up with a pretty basic solution. i just split the tags by ; and then again by :. That gave me a keyed array an consequently weeded out the duplicates.