Book HomeCascading Style Sheets: The Definitive GuideSearch this book Saturday 29th of November 2014 12:48:39 AM

Appendix A. CSS Resources

Contents:

General Information
Tips, Pointers, and Other Practical Advice
Online Communities
Bug Reporting

There are a number of very good CSS-related resources available on the Web. Here are some of them.

A.1. General Information

These resources provide a good overview of what's happening in the world of CSS or otherwise provide you with a broad look at CSS.

A.1.1. CSS Recommendations

http://www.w3.org/TR/REC-CSS1

http://www.w3.org/TR/REC-CSS2

When all else fails, you can always use the source, Luke. The specifications contain, albeit in a somewhat terse and not always easily decipherable form, the complete description of how conforming user agents should handle CSS. They also contain a complete CSS parsing grammar and forward-compatible parsing rules, both of which are invaluable to the people who write user agents but of minimal interest to almost everyone else.

A.1.2. W3C CSS Activity Page

http://www.w3.org/Style/CSS

This is, officially speaking, the online center of the CSS universe. There are links to the CSS Recommendations, to new ideas under consideration, and to other sites about CSS. There are links to historical style sheet proposals, to information about current usage and implementations of CSS, and more. There are also lists of books about CSS, news of new CSS tools, and many other useful bits of information.

A.1.3. W3C CSS Test Suite

http://www.w3.org/Style/CSS/Test/

This presents a fairly complete set of pages designed to test any CSS implementation. Each page of the suite tests various aspects of CSS properties, one property per page. The tests were largely developed by the author of this book, Håkon Lie (Opera Software), and Tim Boland (NIST), with many contributions from the CSS community and even the browser vendors themselves. If you're wondering how good your browser is at handling CSS1, this is the place to find out. As of this writing, the Test Suite covers only CSS1, but a CSS2 Test Suite is expected in the near future.

A.1.4. Error Checkers

You can save a lot of time and effort simply by running your CSS through a validity checker. This is particularly recommended if you're thinking about asking for help online, because if your CSS contains errors, the first thing the experts will tell you to do is to use a validator. May as well get into the practice first.

A.1.4.1. W3C CSS Validator

http://jigsaw.w3.org/css-validator/

If you're having trouble getting your style sheets to work, it might be the result of a typographical error, or some other basic error that is difficult to diagnose. You could spend a long time combing through your styles, exhaustively checking each rule for correctness -- and that's a good exercise, of course -- but you could also have a program do it for you, and simply tell you if it found any errors. The W3C CSS Validator will do exactly that. You can supply it with the URL of a style sheet or document containing styles, or simply paste a block of styles into an input field, and let the validator tell you if your problems are the result of a misspelled color name (or something similar). The chief drawback, for most people, is the technical nature of its reporting. Unless you're already familiar with HTML and CSS, the results you get back may be somewhat confusing.

A.1.4.2. WDG CSScheck

http://www.htmlhelp.com/tools/csscheck/

negative length value, with the obvious difference that the amount ofnegativity will depend on the width of the parent element. Thus:

P {margin: -10%;}

Figure 7-20 illustrates the consequences of such arule, where the amount by which paragraphs overlap each other andspill beyond the browser window is entirely dependent on the width ofthe window itself -- and the wider the window, the worse thesituation becomes.

Similar in nature to the W3C's validator, CSScheck offers much friendlier error messages, which makes it more useful to the beginning author. In addition to indicating the severity of the error with whimsical icons (American-style traffic signals, at last check), CSScheck provides a message detailing each problem, as well as the reason it is a problem. It is possible to learn a great deal about good document authoring practices simply by running a few style sheets through CSScheck and carefully reading its responses.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.

Figure 7-35

Figure 7-35. Using solid to stand in for unrecognized border styles

You may have noticed that all of the examples in this section hadborders of exactly the same width. That's because wedidn't define a width, so it defaulted to a certain value.Next, we'll find out about that default, and muchmore.

There are four ways to assign a width to a border: you can give it alength value such as 4px oroverwrite one another.

3. The right outer edge of a left-floating element may notbe to the right of the left outer edge of any right-floating elementto its right. The left outer edge of a right-floating element may notbe to the left of the right outer edge of any left-floating elementto its left.

This rule also prevents floated elements from overlapping each other. Let's

3.1.2.3. Hexadecimal colors

If you've done any web authoring in the past and have ever set a color in the course of that authoring, then this part will be a snap. You can set a color using the same hexadecimal notation so familiar to web authors:

H1 {color: #FF0000;}   /* set H1's to red */
H2 {color: #903BC0;}   /* set H2's to a dusky purple */

all elements

floatIE4 P/B IE5 P/Q NN4 P/P Op3 B/-

Sets thefloat direction for an element. This is generally applied to imagesin order to allow text to flow around them, but under CSS1 anyelement may be floated. Note that, for elements such as paragraph,floating the element will cause its width to tend toward zero unlessan explicit width is assigned; thus, width assignment is a crucialpart of floating any nonreplaced element.

already halfway to an understanding of how it works. Most of whatremain are the details of what happens when absolute positioning isinvoked.

When an element is positioned absolutely, it is completely removedfrom the document flow. It is then positioned with respect to itscontaining block, and its edges are placed using the side-offsetproperties. The positioned element does not flow around the contentof other elements, nor does their content flow around the positionedelement. This implies that an absolutely positioned element may