/ Are inline styles bad?

Posted originally as a comment on 456 Berea Street. I had also originally posted a comment on this very same topic on Emil Stenström’s Friendly Bit.

A sign reading: Wrong WayI believe that the style attribute is allowed because the purpose of separation is nonetheless achieved via CSS. Whether its included directly in the page via inline styles or in a separate stylesheet, the presentation and structural layers are still kept separate. You have to remember that the push behind separation came from a) the misuse of structural elements such as the paragraph tag for adding spacing and b) the use of sanctioned structural markup for presentational purposes (such as

and ). With CSS, all that is presentational is taken out of the markup and either relegated to a separate file, or to attributes within the markup which are exactly that, attributes, not actual markup. Therefore separation is maintained. </p> The question is then not one of separation but one of efficiency. Is it more efficient and therefore simpler to maintain when we use separate stylesheets? The answer in most cases is yes. However, if you take that approach to the extreme you begin to introduce other problems such as the difficulty of maintaining separate stylesheets for different locales in the case if image replacements etc… Or, you start *generating* stylesheets (which introduces all kinds of overhead) simply to avoid using an inline style attribute. I think whats called for isn’t so much a fundamentalist and/or extremist approach where everything is black or white. Rather, if we are to treat our trade as the art form that it is, and if we are to call ourselves seasoned professionals, then we should implement the years of wisdom we’ve acquired and make educated judgment calls as to when and where to use the tool provided to us in the form of the style attribute.


Read more from the archive.