untitled

(John Hannent) #1
HTML didn’t have an indentation capability, so people resorted to inserting
invisible images and other tricks. (Adding spaces doesn’t work because
HTML strips extra spaces off.)

CSS came to the rescue with its text-indentproperty. Used with block-level
elements like <p>, you can specify a unit length like 6emor 7px, or a relative
percentage.

Here’s the way you specify indentation for a paragraph, as shown in
Figure 7-15:

p {font-size:24px; text-indent: 2em;}

Texturing ......................................................................................................


Most Web sites look best with some background textures and graphics. Plain
background colors are rather crude, but a nice, restrained, pale texture
behind your text improves many a Web page. Add some well-placed graphics
and you can bring the drabbest page to life. Textures also help to unify a
page, tying the various zones together.

As with drop-shadows and many other visual effects that you might want
to add to a Web page, your best approach when adding backgrounds is to
design them in a graphics application such as Photoshop.

For example, you can create a background out of a small, repeating texture.
The example in Figure 7-16 tiles a tiny 1'' piece of texture across the entire
background of the browser. It works much the same way that tiling textures

Figure 7-15:
In most
publications,
text is
indented.
HTML has
no pro-
vision for
indentation,
but CSS has
the text-
indent
property.


Chapter 7: Styling It Your Way 143

Free download pdf