Controlling Space around Elements

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.
<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.

TIP

When you ...

Get Web Design Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.