Override Inline CSS – I had no idea!

Just came across this link via dZone.

http://css-tricks.com/override-inline-styles-with-css/

<div style="background: red;">
    The inline styles for this div should make it red.
</div>

We can fight that with this:

div[style] {
   background: yellow !important;
}

It doesn’t work in IE6, if you care.  But the places where I’ve needed this trick, I don’t care.

Related Post

  • Experiments with cascading style sheetsExperiments with cascading style sheets Every once in a while, I like to use StumbleUpon to see what's out there.  Tonight, I found this site.  This is probably the best CSS site I've seen yet.  Not just a bunch of how-to ...
  • Secret to Unique FavIcon.ico files in DotNetNukeSecret to Unique FavIcon.ico files in DotNetNuke Well, it was a secret to me until yesterday anyhow. If you are running a DotNetNuke installation with multiple portals, you may have noticed that even if you replace the FavIcon.ico file in the...
  • Finding a CSS Class DefinitionFinding a CSS Class Definition A couple of weeks ago I pointed out that you could easily find the definition of a property, method, variable, or class by right-clicking the item and selecting, "Go To Definition" from the contex...
  • Just an Observation…Just an Observation… I've been lurking in both the Microsoft and PHP Newsgroups for the last week or so and while I know the Microsoft groups have "people" in them too, what I've noticed is that when the people in the ...
  • ASP.NET Debugger Timeout . . . Solution FoundASP.NET Debugger Timeout . . . Solution Found ... and such a simple solution! I've been fighting this one for quite a while.  Glad someone figured out a way around it. Vault of Thoughts - .NET Blog - ASP.NET Debugger Timeout In Windows V...