A Complete Guide to Web Design

(やまだぃちぅ) #1

389


CSS

Web Design in a Nutshell, eMatter Edition

Chapter 23CSS

CHAPTER 23


Cascading Style Sheets


For those frustrated with the limited control over document presentation provided
by straight HTML markup, Cascading Style Sheets are a welcome advance in web
design. Like their counterparts in desktop publishing page-layout programs, style
sheets in HTML allow authors to apply typographic styles and spacing instructions
for elements on a page. The wordcascadingrefers to what happens when several
sources of style information vie for control of the elements on a page—style infor-
mation is passed down from higher-level style sheets (and from parent to child
element within a document) until it is overridden by a style command with more
weight. (The cascading rules are discussed in detail later in this chapter.)


This comes as good news for both designers who want more control over presen-
tation, and for HTML purists who stand by the principle that style should be
separate from content and structure. Style sheets make both these dreams possible.


We’ve classified style sheets as an “emerging technology” (rather
than straight HTML) based on the fact that a low percentage of
browsers in current use support them. Furthermore, it is difficult to
develop CSS because Netscape and Internet Explorer have imple-
mented them differently and inconsistently. As of this writing, CSS is
a promising yet still somewhat risky technology.

Advantages



  • Greater typography and page layout controls.With style sheets, you can spec-
    ify traditional typography attributes such as font size, line spacing, and letter
    spacing. It also offers methods for specifying indents, margins, and element
    positioning. It even uses terminology from traditional and desktop publishing
    such as points and em spaces.

Free download pdf