Sams Teach Yourself CSS in 10 Minutes

Styling the <p> Element

The <p> element must be padded on both sides to keep it away from the edges of its container. This can be achieved using padding: 0 20px as shown in Listing 17.5. The results can be seen in Figure 17.7.

Listing 17.5. CSS Code for Styling the <p> Element

div#pullquote { margin: 2em; background: #09f url(lesson17a.gif) no-repeat; } div#pullquote h2 { margin: 0; padding: 20px 20px 0 20px; background: url(lesson17b.gif) no-repeat 100% 0; } div#pullquote p { padding: 0 20px; }

Figure 17.7. Screenshot of styled <p> element.

Категории