HTML and CSS Reference
In-Depth Information The pros and cons of inline styles
At the end of the cascade, inline styles override the more general styles.
Get into the habit now of using inline styles rarely and just for that pur-
pose. You cannot reuse inline styles, making style management difficult.
Moreover, such changes are spread throughout your documents, mak-
ing finding and altering inline styles error-prone. (That's why we might
eschew tag- and attribute-based styles in the first place, no?)
Anytime you use an inline style, think long and hard about whether you
might accomplish the same effect using a style class definition. For in-
stance, you are better off defining:
<style type="text/css">
p.centered {text-align: center} {color: blue}
and later using:
<p class=centered>
<em class=blue>
rather than:
<p style="text-align: center">
<em style="color: blue">
Your styles are easier to find and manage and can easily be reused
throughout your documents.
Search WWH ::

Custom Search