Chapter 6. The Fundamental Objects


When a document displays on a user's screen, what shows up is not the underlying HTML code. Instead, it is the browser's interpretation of that code. In the absence of any explicit instructions to the contrary, the browser displays the document using a set of default parameters. In HTML, for example, the browser puts P elements in separate blocks of text and LI elements in blocks with a label on the side, but it does not create a separate block for EM elements.

You can affect the basic shape of elements onscreen by using the display property. With this property, you can specify that each element be displayed onscreen as one of the following:

  • A block of text For example, paragraphs and headings are usually (but not always) displayed as a text block.

  • As part of a line of text For example, inline elements such EM and SPAN.

  • A list item, a block with a label (number or bullet) on the side For example, an L1.

  • A "run-in" header A header that starts a new block of text but doesn't have a line break after it (see the section, "The "run-in" value").

  • A compact label in the margin, such as the DT element in some types of list.

  • A cell or row in a table (table layout is explained in Chapter 17, "Tables").

In this chapter, we show you how to use the display property to influence the form of elements onscreen. You may think that a heading will always be displayed in its own block or that a list item will always be part of a stepped-out list, with list item on top of list item, but this is not the case. By changing the display property, you can create entirely different effects. We give you some examples of how this is done.

In this chapter, we also discuss two related properties:

  • List-style property (actually a set of four properties), which enables you to create lists with different types of numbers or bullets

  • White-space property, which lets you control how tabs, newlines, and extra white spaces are handled

This chapter also explains how to insert extra text before and after elements. This is useful if the standard list bullets and numbers are not sufficient, but it can do much more.



Cascading Style Sheets(c) Designing for the Web
Cascading Style Sheets: Designing for the Web (3rd Edition)
ISBN: 0321193121
EAN: 2147483647
Year: 2003
Pages: 215

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