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.

Like this Article? Subscribe to get every article sent to your email.

Related Post

  • 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 […]
  • 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 […]
  • iText IN ACTION – Creating and Manipulating PDFiText IN ACTION – Creating and Manipulating PDF While this isn’t specifically targeted at iTextSharp, which we’ve been covering in recent posts, this is really the closest book you are going to find on the subject. The basics are […]
  • Tab Control ActiveTabIndex Lost on PostbackTab Control ActiveTabIndex Lost on Postback I just got off the phone with a client who is using the MS-AJAX TabControl in one of his applications and any time he causes a postback, the tab resets to the first tab. If you've never […]
  • String and StringBuilderString and StringBuilder A couple of weeks ago, we discussed Value types and Reference types where we said that a reference type points to the value it represents and a value type is the value it represents. […]

About Dave Bush

Dave Bush is a Full Stack ASP.NET developer. His commitment to quality through test driven development, vast knowledge of C#, HTML, CSS and JavaScript as well as his ability to mentor younger programmers and his passion for Agile/Scrum as defined by the Agile Manifesto and the Scrum Alliance will certainly be an asset to your organization.

One Pingback/Trackback