CSS' margin attributes apply to more than just the borders of the page. You can apply margins to any element, thereby adjusting the space around it, as in Figure 49.1. Listing 49.1. View Source for Figure 49.1.[View full width] <p style="margin-bottom: 200px;">This paragraph has a bottom margin of 200 pixels. This is the end of the paragraph.</p> <p>This is the beginning of the next paragraph, after a healthy stretch of white space.</p> Figure 49.1. This paragraph has a bottom margin of 200 pixels, which creates a nice chunk of whitespace to separate the paragraph from what comes after.
There are four margin attributes: margin-top, margin-bottom, margin-left, and margin-right. Each can have a different value and unit (see Topic 48 for a table of valid CSS units). As the View Source for Figure 49.1 shows, you don't have to set all four margin attributes. Just specify the margins you need for proper spacing.
|