22.04.2013 Views

HTML, XHTML & CSS

HTML, XHTML & CSS

HTML, XHTML & CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Positioning<br />

Chapter 12: Top 20 <strong>CSS</strong> Properties<br />

identical to padding-top: 0.5em; padding-right: 0.5em; paddingbottom:<br />

0.5em; padding-left: 0.5em;.<br />

Close inspection of the figure shows that padding extends the text box around<br />

the element, including the background. Using margin, on the other hand,<br />

moves the edges of the text box away from the edge of the parent text box so<br />

that content is indented all the way around. The combination of the two (see<br />

the final pair of elements in Figure 12-8) extends the background around the<br />

elements (padding) and moves the edges to accommodate their margins.<br />

Figure 12-8: Margin and padding at work separately and together.<br />

Positioning controls (see Table 12-6) define where elements appear on a page,<br />

how elements relate to one another, and how text flows (or doesn’t) around<br />

various elements. The TRBL properties (top, right, bottom, and left) come<br />

into play here, and elements may be positioned absolutely (with reference to<br />

the origin, or upper-left corner of the page) or relatively (with reference to<br />

whatever element encloses them).<br />

<strong>HTML</strong> source code for all of the figures in this chapter (and the rest of the<br />

book) are available at www.dummieshtml.com. There, you can find the relevant<br />

source in the Chapter 12 section (labeled Figure 12-1, Figure 12-2, and<br />

so on).<br />

201

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!