Why use CSS?
Posted Aug 4, 2004 at 01:21 AM
The modern approach to handle presentation and formatting on the web is to use a separate language independent of the markup, namely CSS. When used, the browser uses the instructions provided in this separate language to determine precisely how to display the HTML markup. This post discusses the benefits inherent in this approach.
Advantages of using CSS
- The XHTML document becomes simpler to write because it can be semantic in nature, and in so doing it can become less sensitive to small changes.
- CSS eliminates the need for extraneous markup, such as font tags, spacer gifs and nested tables. This improves end user load time and greatly simplifies development and versioning.
- External CSS files are cached by browsers (after all, they change far less frequently than the content in the XHTML), further improving load time.
- Since the same CSS file(s) can be shared across many XHTML documents, editing a single CSS file, can instantly deploy page- and site-wide design updates, without any changes to the markup.
- CSS can be authored and targeted to different media types to provide appropriate presentation and formatting for screens, printed versions of the pages, and mobile devices.
- The practiced use of CSS encourages proper XHTML structure, which improves accessibility, cross-browser support and search engine placement.
- CSS encourages the use of logical, semantic names for page elements, such as identifying a <div> with an ID of “header”, or associating an <h1> with the class of “headline”. It’s self-describing, and good use of it reinforces the semantic meaning of the markup, making it easier to work with, explain and understand.
- CSS provides greater presentational power than XHTML does alone. Examples: better font control, absolute positioning, nifty borders.
- CSS’s :hover pseudo-class cuts down on the need to use JavaScript onmouseover calls.
- It’s use is required for styled pages that are valid XHTML, since formatting-focused tags and attributes have been deprecated from the XHTML schema.
- It focuses design efforts much more on the CSS than on the markup, and results in less code churn for design implementations, tweaks or redesigns.
About this page
This page contains a single post from Daniel Boerner's blog, of which Boot Camp + Windows Vista = no more Airport Extreme reboots is the latest post.
Are there more posts like this one?
Possibly. Within this blog, this post is categorized under webdev and it was posted on August 4, 2004. Those would be good places to start looking for related posts.
Next post (newer)
Choosing values for XHTML class and ID attributes
This post is closed to new comments.