Originally Posted by Andrew R
What's so wrong with using inline styles? I use them all the time for minor things that don't warrant a completely new style. For example, div#main might not always need to be floated left, and div.contentHeader could only need the top margin for the first one.
|
Then you make a new class, that just floats left.
Inline styles are a bad habit. It's all about separation of content and style.
1. Inline styles don't separate content from design
In fact, inline styles are exactly the same as embedded font tags and other design tags that we're trying to stop using. The styles only affect the exact tag they are applied to, and while that might give you more control, it also makes other aspects of your design and development more difficult.
2. Inline styles cause more maintenance headaches
When you're working with style sheets, it can sometimes be very difficult to figure out where a style is being set. When you add a mixture of inline, embedded, and external styles and you have even more locations to look. And if you work on a Web design team or have to redesign or maintain a site built by someone else, then you're going to have even more trouble. Then, once you find the style and get rid of it, you'll have to get rid of it on every element on every page where it's been placed. Which can increase your maintenance work astronomically.
3. Inline styles are not as accessible
While a screen reader or other assistive device might be able to handle the attributes and tags effectively, some of the older devices don't and can result in some strange Web pages. Plus, the extra characters and text can affect how your page is viewed by a robot such as a search engine, so your page optimization would not do as well as a page with external style sheets.
4. Inline styles make your pages bigger
If you set a style on every paragraph on your site, you can do it once with like 6 lines of code and an external style sheet. But if you do it with an inline style, you'll have to add those styles to every paragraph of your site. If you have 5 lines of CSS, that's 5 lines multiplied by every paragraph on your site. That bandwidth can add up in a hurry.
|
http://webdesign.about.com/od/css/a/aa073106.htm