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 Sunday 30th of April 2017 03:08:36 AM

by Eric A. Meyer
ISBN 1-56592-622-6
First edition, published May 2000.
(See the
catalog page for this book.)

Search the text of Cascading Style Sheets: The Definitive Guide.

Table of Contents

Copyright Page
Preface
Chapter 1: HTML and CSS
Chapter 2: Selectors and Structure
Chapter 3: Units and Values
Chapter 4: Text Properties
Chapter 5: Fonts
Chapter 6: Colors and Backgrounds
Chapter 7: Boxes and Borders
Chapter 8: Visual Formatting
Chapter 9: Positioning
Chapter 10: CSS2: A Look Ahead
Chapter 11: CSS in Action
Appendix A: CSS Resources
Appendix B: HTML 2.0 Style Sheet
Appendix C: CSS1 Properties
Appendix D: CSS Support Chart
Index
Colophon
Library Navigation Links

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

will hold up in more than one media; for example, documents that will look good on a monitor as well as a printout.

It's also possible to mix percentages with length values. Thus, to set H1 elements to have top and bottom margins of one-half em and side margins that are 10% of the width of the browser window, you can declare the following, shown in Figure 7-12:

H1 {margin: 0.5em 10% 0.5em 10%;}
Figure 7-12

Figure 7-12. Mixed margins

8.4.2.2. Adding box properties

As we're aware from previous discussions, padding, margins, and borders may all be applied to inline nonreplaced elements, and they don't influence the line-height at all. If we were to apply some borders to a SPAN element without any margins or padding, we'd get results such as that shown in Figure 8-57.


Controlling line breaks, alignment and indents

The   character is a non-breaking space that can be used to insure line breaks don't occur between certain pairs of words in a title. 

To maintain strict control of line breaks, enclose your content in a <NOBR></NOBR> tag and then insert <BR> tags to specify exactly where you do want the line breaks to occur.  You can also include <WBR> tags to indicate where optional line breaks may occur if the line extends beyond the right edge of the browser window. what's coming soon -- or, if you're reading this booka year or three after its publication, what can be done.

You may notice that, unlike other chapters, almost none of thefigures in this chapter was generated with a web browser. This issomething of a statement about the reliability and consistency ofpositioning implementations at the time of this writing: not one ofthem was solid enough to trust completely. It was actually easier todraw theoretical examples by hand than to take screenshots in webbrowsers and then retouch them in Photoshop.

For the most part, the text in both paragraphs looks fairly normal. In the second one, however, the place where the boldface element would have appeared is simply closed up, and the positioned text overlaps the some of the content. There is no way to avoid this, short of positioning the boldfaced text outside of the paragraph (by using a negative value for right) or by specifying a padding for the paragraph that is wide enough to accommodate the positioned element. Also, since it has a transparent background, the parent element's text shows through the positioned element. The only way to avoid this is to set a background for the positioned