WebReference.com - Excerpts from chapter 1 of Cascading Style Sheets: Separating Content from Presentation, from glasshaus
Cascading Style Sheets:
Separating Content from Presentation
Chapter 1: Foundation Concepts
[The series of excerpts below are from Chapter 1 of the glasshaus title Cascading Style Sheets: Separating Content from Presentation.]
The World Wide Web (the Web for short) is a massive media revolution, producing not only a massive spike in the US and world economies in the last years of the 20th century, but also empowering individuals and organizations with self-publishing capabilities and a ready-made world-wide audience. Where the printing press gave us the ability to record and distribute information, the Web increased those abilities exponentially, removing the barrier of the commercial publishing system to the production of self-published materials.
Due to its revolutionary nature, the Web has been the subject of massive hype, commercial gold-digging, and genuine advances in human communications; and not in equal amounts. But in spite of the abuses, the Web has blossomed as both a mode of self-expression for countless self-publishers, as well as a viable commercial center and a powerful digital library.
However, the Web is certainly not without its problems. After enjoying half a decade of optimistic growth, the web economy has been fed a dose of reality. Gone are the days of the dot com millionaire made over night with a web server and a good idea. Gone are the days of abundant high-salaried dot com jobs. These are the days of struggling web businesses, fighting to find the proper model that works in these uncharted waters of the Web, slashing costs and cutting payroll.
The economic troubles are not the only challenges facing the Web; there are also technological hurdles that must be leapt, for in the Web's early growth, expediency and pizzazz won over wisdom and solid development practices. Some of the blocks that were laid in the early explosion of web growth were faulty at best, and remain unsuitable as foundations for future building.
Recall that the Web is an interconnected group of computers, from the army of small iMacs and PCs
on the desktops of homes and offices around the world, to massive web server farms that feed pages to
an ever-increasing audience. On these web servers are documents (
web pages), each of which can be
connected to other documents via hyperlinks. Web surfers use web browsers, like Netscape's Navigator,
Microsoft's Internet Explorer, or the Opera browser, to retrieve and view these web pages from the
web servers that serve them.
As you know, the web pages themselves are constructed with a markup language called HyperText Markup Language (HTML). Using a markup language, an author "marks up" a document with structural and other meta-information right along side the document's content. As innocuous as that may sound, HTML is at the center of one of the technological struggles the Web now faces, a struggle which is quickly reaching a crossroads: is HTML to be used as a presentation language, used to define the visual appearance of a web page, or is it to be used as a traditional markup language, defining the structure of documents and leaving layout and visual design to a style language. It's a complicated question, and at its heart lies the subject of this book: Cascading Style Sheets (CSS).
To understand the difference between "structure" and "presentation", consider the following sentence:
"William Faulkner's Sanctuary is one hell of a scary book."
Structurally speaking, the word "Sanctuary" is a book title; in terms of presentation, on the other hand, the word is underlined. This distinction is lost on many because of the ubiquity of word processing applications such as MS Word, which blur the line between structure and presentation. In a word processing application, we don't select the text "Sanctuary" and hit the "book title" button. We hit the "U" button, which underlines it as we wish. In the following sections you'll see why marking up text structurally produces more powerful documents.
CSS is a style language that can be used in conjunction with HTML to define the visual presentation of a web page. "If that's the case", you might ask, "then why is there any question of using HTML as a presentation language?" The short answer is that CSS did not exist until 1996, five years after the birth of the Web, and even now is not fully supported by the dominant web browsers. Thus, web professionals have taken to twisting HTML to suit their own design and presentation purposes, misusing the markup language and adding elements to pages that contribute nothing to the content.
Style languages may also be used to control more than just the visual presentation of documents; for instance, aural browsers can use stylesheets to guide inflection and intonation when reading documents aloud to sight impaired persons. This book will deal nearly exclusively with stylesheets used for visual browsers, but it is important to note that the markup practices recommended herein will also allow you to attach other types of stylesheets to your documents. The Web is bigger than what we can see.
As we'll see shortly, this situation has improved dramatically in recent years, and CSS now represents great hope for the Web's future.
Created: June 10, 2002
Revised: June 20, 2002