Daniel Hoelbling-Inzko talks about programming

Inline Styles aren't all that evil

Posted by Daniel Hölbling on August 21, 2008

Everyone who did some web stuff and had to do some HTML had fun with the style="" tag.
It's the simplest way to change the appearance of something and also very intuitive (right at the point where you want the change to happen). So, everyone of us is sometimes hacking some style="" stuff from time to time ;).

You usually continue to do so until the whole thing backlashes and you have absolutely unreadable code because every <div> tag is 3 lines long and you can't distinguish between style and markup.
So, that's the point where we all learned: Inline Styles are evil!

Now, while reading some RSS feeds today I discovered that inline styles aren't completely useless nowadays. Especially in times of RSS content syndication, sometimes it's very important to attach the style to the markup, so your markup remains readable at the external source.
Most RSS readers don't strip the inline CSS markup, and you may very well use this to format your feed accordingly. E.g. images that should be floated don't look good in a feed reader if they break the article they should illustrate, so attaching the "float: left; margin-right: 10px;" isn't too obscuring, but helps your readers a lot.

So, although inline styles really contradicts the DRY principle, sometimes it's cool to use them for syndication reasons.

Filed under programmierung, internet
comments powered by Disqus

My Photography business


dynamic css for .NET