CSS: An Intro to CSS
THIS SECTION COVERS:
-
The History of CSS
-
The Beauty of DHTML & CSS
-
The Advantages of CSS
-
The Disadvantages of CSS
Cascading Style Sheets (CSS), supported by W3C, was
first proposed in 1994 by Hakon Wium Lie. It is one component of DHTML (Dynamic
Hypertext Markup Language) which combines HTML with scripting, multimedia,
document object model (DOM), CSS, and other technologies to change how text and
graphics are displayed on a screen. Through the use of DHTML, scripting
provides interactivity while CSS adds the style. The beauty of CSS is it works
with conventional HTML to provide almost all the typographical and page layout
formatting similar to desktop publishing (DTP) that HTML alone does not. These
include:
-
fonts
-
color
-
borders
-
backgrounds
-
alignment
-
absolute positioning
-
leading (line spacing)
-
kerning (letter spacing)
-
effects (dropshadow and glow - IE only)
This means you are no longer limited to seven heading sizes, objects can be
positioned by location specification, and formatting changes can be done easily
and quickly. You now have "control" over page style.
If this was the chapter you skipped with the promise of going back later, or
you want to become familiar with CSS, follow along and find out the powers of
CSS.
Advantages of CSS
-
Several different style sheets can be used and affect the same page as the term
"cascading" implies. A style sheet can be specified for page presentation, but
another style sheet can be added to change the page appearance to meet the
needs of the audience. For example, a larger type may be needed for those with
poor eyesite or a preferred font or color may be desired. This ability to make
changes easily to accommodate audience needs is a very powerful feature of CSS.
-
Using CSS puts the designer in the driver's seat. Think of HTML as the
structure of a document while CSS controls the appearance.
-
Using CSS saves time when changes are needed and consistency in site appearance
is gained. Changes can be specified once rather than page by page or can be
applied to an entire site by editing the external style sheet file. This is
especially important when pages are generated by databases and CGI scripts.
-
CSS is easy to learn as the written rules use HTML "tags".
Disadvantages of CSS
-
The biggest drawback is browser compatibility. Currently, only IE 5 fully
supports CSS. while Netscape 4.0 does not provide full support. A browser
should be able to ignore CSS style selectors and revert to standard HTML if it
is incapable of implementing CSS.