Veera
Veera

Reputation: 33182

Overriding inline CSS styles in IE7

I have a html tag with inline CSS style like: <body><div style="position:absolute;top:100px;"></body> and I want to override this inline position property. So, I wrote a CSS rule like this:

body > div[style]{position:relative !important;top:0px !important;}

The above code works in Firefox. But in IE7 it does not work. Am I missing anything for IE?

PS: Even though I could see my overridden attributes in Firebug lite window, it's not affecting anything on my page. (Plz refer the attached image).

alt text

Upvotes: 2

Views: 4161

Answers (2)

Will Prescott
Will Prescott

Reputation: 4053

The style attribute selector is not supported in IE7: http://reference.sitepoint.com/css/css3attributeselectors

Upvotes: 2

Ad Taylor
Ad Taylor

Reputation: 2775

Your selector doesn't need to be that specific - I'm not sure but I'm not sure IE7 would understand it. The !important should override it.

Have you tried this?

body div {position:relative !important;top:0px !important;}

Upvotes: 2

Related Questions