PDA

View Full Version : CSS Code Taking precedence Question



phaze112
Jun 4th, 2009, 08:34 PM
Hey guys I have a question about how I can get a certain piece of CSS Code to take precedence over some later CSS code defining the same thing.


Is this possible at all? Like to set it globally and not changeable no matter if it gets redefined later on the html page or not?


Thanks

SB65
Jun 4th, 2009, 09:25 PM
Could you provide a little more information - is there a reason why the same element is defined twice, but differently?

phaze112
Jun 4th, 2009, 11:25 PM
Could you provide a little more information - is there a reason why the same element is defined twice, but differently?

Well it is defined once by php code which accesses 3rd party servers which generate the html code along with some styles.


I'd like to override these styles that the php code is generating, and I'm just wondering what my best options are.

If I was able to globally declare a style and have not not be reset, then the php code defining that style later on in the webpage would not matter... that's what I was thinking... if that is even possible.

Kristofa
Jun 5th, 2009, 01:21 AM
There is a way, you include !important in the CSS you wish to take precedence I believe, will just check on that...

Edit: Yes that's right. Here's an example.

body {
color: black !important;
background: white !important;
}

* {
color: inherit !important;
background: transparent !important;
}