|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
CSS Question: Is this legit / supported / compliant?
I'm wondering if duplicate / overriding directives are allowed in the CSS Spec.
Here's an example: Code:
<div style="background-color: black; background-color: white"> will the second call to background-color override the first and be drawn as 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.
__________________
-Paul Wieland_____________ http://www.sickdimension.com |
|
#2
|
|||
|
|||
|
i know it's not legit and i think it could cause problems bij some browsers rejecting the css
|
|
#3
|
||||
|
||||
|
The CSS validator at w3c.org does not return an error nor a warning when you re-declare a style like you have.
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
|
#4
|
|||
|
|||
|
interesting...
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. |
|
#5
|
||||
|
||||
|
You don't want to use JavaScript to set the style?
__________________
Hello, old friend... |
|
#6
|
|||
|
|||
|
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.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS Question: Is this legit / supported / compliant? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|