Chapter 11. Introducing CSS


Back in the dark ages of the Web, the favorite sport of designers was to bemoan their lack of control over the appearance of Web pages. Suddenly, their most basic assumptions about their abilities were called into question. They were unable to precisely position objects on Web pages, and they had little control over the look and specifications of type on those pages. In fact, the whole concept of a "Web page" was annoyingly fuzzy; in the print world, a designer always knows the dimensions of the piece of paper for which they're designing. But on the Web, there are no fixed page sizes.

The Cascading Style Sheets specifications from the World Wide Web Consortium (aka the W3C, which develops Internet standards; http://www.w3.org ) allows designers to specify the look of page elements, including type, as well as position those elements precisely on the Web page. Besides these abilities, CSS allows designers to easily do something at which they excel: change their minds. If the look of the elements of your site is defined according to a style sheet, in order to change the look of the site, you simply need to change the definitions in the style sheet, and the changes are automatically applied. Using CSS allows Web designers to spend more time designing, rather than wrestling with HTML's limitations.

You'll note that there isn't any JavaScript in this chapter; we're taking this brief detour because you must know some CSS in order to understand the concepts behind later chapters. In this chapter, you'll be introduced to CSS. You'll see how to use CSS for text formatting and also for positioning page elements.

About the CSS Specs

There are three CSS specifications altogether. CSS1, which specifies text formatting, was standardized in December 1996. CSS-P (where the "P" stands for "positioning") was first introduced in January 1997. CSS2 was standardized in May 1998 as a fusion of the previous two standards, encompassing both formatting and positioning. As of this writing, over eight years after CSS2 was adopted, no shipping browser fully and completely supports all of these standards. But most modern browsers do a pretty-good-to- excellent job of displaying CSS, including Microsoft Internet Explorer 6 and later, and Firefox 1.0 and later. Apple's browser, Safari, has very good CSS2 support.

As of August 2006, the W3C is putting the final touches on CSS 2.1, which serves as a "snapshot" of the CSS features that have actually been implemented by the major browser makers . It also removes CSS2 features that the community's consensus agrees will not ever be widely implemented. The W3C started work on CSS 2.1 in 2002, which should give you an idea of how quickly they work.

The specification that will be CSS3 has been in progress since 1999, so we're not holding our breath on the W3C making any final decisions shortly here, either. If you want to see the current status of CSS 2.1 or CSS3, check http://www.w3.org/Style/CSS/current-work .





JavaScript and Ajax for the Web(c) Visual QuickStart Guide
JavaScript and Ajax for the Web, Sixth Edition
ISBN: 0321430328
EAN: 2147483647
Year: 2006
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net