On a completely different note is the pseudo-class :lang, which is used to apply styles to elements with matching languages. Let's say you want all paragraphs in English to be black on white, and all paragraphs in French to be white on black:

P:lang(en) {color: black; background: white;}
P:lang(fr) {color: white; background: black;}

Of course, user agents aren't likely to figure out element Book HomeCascading Style Sheets: The Definitive GuideSearch this book Saturday 13th of February 2016 10:08:33 PM


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/

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.

We can take that further and decide to set a wavy border along thetop of each H1 element, as illustrated in Figure 6-35. The image is colored in such a way that itblends with the background color and produces the wavy effect shown:

H1 {background-image: url(wavybord.gif); background-repeat: repeat-x;background-color: #CCCCCC;}
Figure 6-35

Figure 6-35. Setting a wavy top border on H1 elements

Simply by choosing the appropriate image for the job, and employingit in some creative ways, you can set up some truly astonishingappearances. And that isn't the end of what's possible.a hidden anchor tag there: <A NAME="top"> </A>  Use anchorsto improve navigability, but remember that multiple linked pages will downloadquicker than one huge page with lots of anchor tags! <P>Note the use of keywords to make the 
browser display special non-ASCII characters literally, e.g.: X&gt; Y and Z &lt; Y
implies X &gt; Z.Note the use of keywords to make the browser display special non-ASCIIand Kursiv are usually mapped to the italic keyword, while oblique can be assigned faces with labels such as Oblique, Slanted, and Incline.

If you wanted to make sure that a document uses italic text in change the value of line-height for any element in the line, including the image itself. Instead, the line box is simply made tall enough to accommodate the replaced element, plus any box properties. In other words, the entirety of the replaced element -- content, margins, borders, and padding -- is used to define the element's inline box. The following markup gives one such example, (shown in Figure 8-65):

P {font-size: 12px; line-height: 18px;}

If the overflow is set to scroll, the element's content is clipped -- that is, cannot be seen -- but some way is provided to make the extra content available to the user. In a web browser, this would mean a scrollbar (or set of them) or another method of accessing the content without altering the shape of the element itself. One possibility is depicted in Figure 9-9, which could result from the following styles:

DIV#sidebar {position: absolute; top: 0; left: 0; width: 15%; height: 7em;