Setting the Margins around an Element

The margin is the amount of transparent space between one element and the next, in addition to and outside of any padding (see page 177) or border (see page 184) around the element.

Figure 11.16. One of the principal margin adjustments is to the wrap div. When you set two values, the first is applied to the top and bottom margins, the second is applied to the left and right margins.We’ll set the top and bottom margins to 20px to give our design a little space.

To set an element’s margins:

Type margin: x, where x is the amount of desired space to be added, expressed as a length, a percentage of the width ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide 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.