HTML and CSS Reference
In-Depth Information
While two technologies are required to make the example, note that CSS when well
executed is both distinct from an HTML document and dependent on it. CSS is not a
replacement for markup; it in fact relies on it. As an example, if an HTML document is
malformed—the tags are not closed properly or other mistakes were made—the CSS may
not attach properly and the look would be distorted. However, mistakes can also be made
in the CSS rules, which tend to be a bit more strictly interpreted by browsers and thus may
similarly result in a visual rendering problem. Clearly, a symbiotic relationship exists
between CSS and HTML, but that relationship has changed over time, so that evolution is
described next.
CSS Versions
Cascading Style Sheets is a fairly old technology as far as the Web is concerned. The first
ideas about CSS were presented as early as 1994, and by December of 1996 the CSS1
specification (www.w3.org/TR/REC-CSS1/) was ratified. This early version of CSS was
partially supported in browsers like Internet Explorer 3 and Netscape 4 to varying degrees.
While the features of CSS1 were far superior to what presentation HTML had with its
<font> tags and workarounds, uptake was slow.
CSS1 provided many features to change borders, margins, backgrounds, colors, and a
variety of text characteristics, but the much demanded ability to directly position objects was
absent. An interim specification on positioning HTML elements commonly called CSS-P for
short (www.w3.org/TR/WD-positioning-19970819) was implemented in Netscape 4 and
Internet Explorer 4 and later rolled into CSS2 (www.w3.org/TR/1998/REC-CSS2-19980512/),
which was released in May 1998. While CSS2 introduced many valuable features, including
positioning, media types for style sheets, aural style sheets, and much more, not everything has
been implemented even in the most modern browsers. A revision of this specification, CSS 2.1
(www.w3.org/TR/CSS21/), released in 2007, removed a number of unimplemented features
and normalized the specification to a more realistic vision of what browsers actually do.
While the future is clearly CSS3 (www.w3.org/Style/CSS/current-work#CSS3) with its
multitude of modules for addressing color, device constraints, foreign language rendering,
improved printing, and more, it is far from clear when that future will arrive. At the time of this
edition's writing, select features of various CSS3 modules have been implemented in some
browsers, but, save for a few high-value features like the opacity property, full cross-
browser support is still spotty. Table 4-1 summarizes the version history of CSS.
Proprietary CSS
For some Web developers, CSS is associated with standards and specification, but the reality
is that, like markup, it too has proprietary features. All browser vendors have introduced
some feature or another to improve what their browser could do. Many of these features are
previews of what is likely to be implemented in the eventual CSS3 specification, but for
now they are proprietary.
Unlike (X)HTML, CSS makes it easy for browser vendors to extend the specification, as
newly introduced keywords and property names that start with a hyphen “-” or underscore
“_” are considered vendor-specific extensions. The syntax is - vendoridentifier - newproperty or
_ vendoridentifier - newproperty , though in practice the hyphenated names appear to be the
only extensions in use. As an example, -moz is used to prefix Mozilla features like -moz-
border-radius . A list of prefixes that are commonly seen is shown in Table 4-2.
Search WWH ::




Custom Search