CSS: Style Sheet Guidelines (1)
According to its creators at W3C, Cascading Style Sheets “is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.” Let's expand that definition to see what it means for Web designers and developers:
- CSS is a standard layout language for the Web—one that controls colors, typography, and the size and placement of elements and images.
- Though precise and powerful, CSS is easy to author by hand.
- It is bandwidth–friendly technology: a single 10K CSS document can control the appearance of an entire website, comprising thousands of pages and hundreds of megabytes. (For an example, see the Sophisticated Style Sheet on page 2.)
- CSS is intended by its creators (W3C) to replace HTML table-based layouts, frames, and other presentational hacks.
- CSS, together with other web standards such as XHTML, helps us separate style from content, making the Web more accessible, and opening it up to more powerful applications and technologies to come.
Laying out pages with CSS instead of HTML tables—or using CSS simply to replace redundant, non–standard HTML hacks, such as invalid extensions to the
<font> tag or the
<body> tag—provides the following benefits:
- Conserve bandwidth (less markup for visitors to download) previous status. Thus, if an image (which is ordinarily treated as aninline element) is floated, it becomes a block-level element. Thisblock-level status helps explain why when an element is floated,other content flows around it.
- Reduce design/development time
- Reduce updating and maintenance time
- Increased accessibility (fewer, or no, HTML tables; no invalid junk markup)
- Adhere to W3C recommendations, improving interoperability and ensuring greater longevity (sites will not become obsolete)
- Better, more professional appearance (line–height, borders, padding, margins)
- Increased readability (line–height, borders, padding, margins)
- More easily transition in future to more powerful standards such as XML (because page content no longer contains junk markup)