Click to buy
Cascading Style Sheets: The Definitive Guide
By Eric A.
Meyer
Introduction
What a Mess
Rich Styling
Ease of Use
Using Your Styles on Multiple Pages
Cascading
Preparing for the Future
Implementations
Bringing CSS and HTML Together
Summary
Printer Friendly Version
Chapter 1
HTML and CSS
Preparing for the Future
HTML, as I previously pointed out, is a structural language,
while CSS is its complement: a stylistic language. Recognizing this, the World
Wide Web Consortium (W3C), the body that debates and approves standards for
the Web, is beginning to remove stylistic tags from HTML. The reasoning for
this move is that style sheets can be used to create the effects that certain
HTML tags provide, so who needs them?
As of this writing, the HTML 4.0 specification has a number of
tags that are deprecated; that is, they are in the process of being phased out
of the language altogether. Eventually, they will be marked as obsolete, which
means that browsers will be neither required nor encouraged to support them.
Among the deprecated tags are <FONT>, <BASEFONT>, <U>,
<STRIKE>, <S>, and <CENTER>.
With the advent of style sheets, none of these HTML tags are necessary.
As if that weren't enough, there is the very strong possibility
that HTML will be gradually replaced by the Extensible Markup Language (XML).
XML is much more complicated than HTML, but it is also far more powerful and
flexible. Despite this, XML does not, of itself, provide any way to declare
style tags such as <I> or <CENTER>. Instead, it is quite probable that XML
documents will rely on style sheets to determine the appearance of documents.
While the style sheets used with XML may not be CSS, they will probably be
whatever follows CSS and very closely resembles it. Therefore, learning CSS
now will give authors a big advantage when the time comes to make the jump to
an XML-based Web.
Limitations of CSS
There are a few areas that CSS1 does not address, and therefore
are not covered in detail in this book; some of these topics are touched upon
in Chapter 10, CSS2: A Look
Ahead. Of course, even a full-blown CSS implementation, covering all of
CSS1 and CSS2, would not meet every request from every page designer in the
world. It's worth going through some of the boundaries of CSS.
Limited Initial Scope
When you get right down to it, CSS1 is not an overly complicated
specification. The entire thing can be printed out in less than 100 pages, and
it contains about 70 properties. It is still a very sophisticated and subtle
engine, but some areas of web design were omitted from CSS1.
In the first place, CSS1 had almost nothing to say about tables.
You might think that you can set margins on table cells, for example--and a
web browser might even let you do so--but margins should not be applied to
table cells under any circumstances. CSS2 introduced a new set of properties
and behaviors for dealing with tables, but as of this writing, few if any of
these are supported.
TIP:
To a certain degree, the omission of tables from CSS1 says a
great deal about the feeling many have that tables should never be used to
lay out pages. It is felt that floated and positioned elements should do all
of the work tables used to do, and more. Whether this premise can be
supported is not a discussion I intend to undertake here.
In a similar way, CSS1 contains nothing in the way of
positioning. Sure, it's possible to move elements around a little bit, but
mostly with negative margins and floating. Everything is, in a sense,
relative. CSS2, on the other hand, has three chapters devoted to the visual
rendering model, which includes the positioning of elements.
CSS1 makes no provision for downloadable fonts. This leads to a
good deal of discussion about how to account for user system configurations
and available fonts. CSS2 introduces some font-handling, but even there the
issue is not resolved, mostly due to the lack of a widely supported font
format. It may be that Scalable Vector Graphics (SVG) will solve some or all
of this problem, but it is impossible at this point to say with any
certainty.
Finally, there is a lack of media types
in CSS1. In other words, CSS1 is primarily a screen-device language,
intended to be used to put content onto a computer monitor. There is some
thought toward paged media, like printouts, but not much. (Despite this,
CSS1 is not a pixel-perfect control mechanism.) In an effort to overcome
this limitation, CSS2 introduces media types, which makes it possible to
create separate style sheets that are applied to a document depending on
its display media. CSS2 also introduces properties and behavior
specifically aimed at paged media and aural media.
Printer Friendly Version
Introduction
What a Mess
Rich Styling
Ease of Use
Using Your Styles on Multiple Pages
Cascading
Preparing for the Future
Implementations
Bringing CSS and HTML Together
Summary