Search code examples
htmlcssinline-styles

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


Solution

  • 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;}