|
Cascading Sheet Styles (CSS) provide a mechanism for
separating page presentation from the structure and
content provided by HTML. CSS becomes even more important
and powerful with XHTML replacing HTML, providing yet
another reason why we
strive to meet the XHTML specifications.
Although W3C's
CSS specifications have been around since 1996,
the major browsers still do not support the current
specifications 100%. One major goal for CSS is to eliminate
the need for tables and frames to be used to for physical
layout purposes. But, until 100% support by the major
browsers happen, only the simplest of pages will be
able to be formatted without the use of tables or frames.
Why is CSS a good idea?
CSS provides a mechanism for making it easier to standardize
the look and feel of a web site. Modifying a style becomes
simpler and quicker than searching for each occurrence
of an HTML tag. For those styles that are supported
by the major browsers, they are supported more consistently
than the associated HTML tag. And, CSS provides some
capabilities that HTML does not have.
Implementing CSS
There are several ways to implement a style. "Inline"
is defining the style within a specific HTML tag (such
as <p>). "Embedded" is defining the
style in the <head></head> section of an
individual HTML document or template. "External"
is having the style definition(s) in a separate file.
Having multiple styles that affect the same HTML tag
is allowed, and, browsers have rules on how to execute
the proper style.
We do not use inline styles, and, we use embedded styles
while initially developing and testing pages. Most of
the time we eventually move styles into external files
since this allows the same style sheet to be used with
multiple pages. Sometimes we will leave embedded styles
in a template document. Using external style sheets
is the most efficient way to provide ongoing maintenance
of styles throughout a web site.
Validation
We use the W3C
CSS Validation Service to test and validate our
use of CSS.
|