How can I override an inline CSS rule using an external file?

css, html

Solution

This is very simple. Use `!important` after your rule style. Here is the example:

.mydiv {background:#f00 !important; color: #000;}

URL: http://jsfiddle.net/msJxL/

And for Internet Explorer, check out How To Create an IE-Only Stylesheet | CSS-Tricks.

Problem

How can I override an inline CSS rule with using an external stylesheet file? This is my HTML code: ``` <div class="mydiv" style="background:#000"> lorem ipsom</div> ``` I want to change the background color using CSS. This is my CSS code: ``` .mydiv {background:#f00; color: #000;} ``` But this is not working, but I this is possible. Is there a way to change the background color in Internet Explorer?

Original source