Setting the Margins around an Element

The margin is the amount of transparent space between one element and the next (Image and Image). See “The Box Model” for how it relates to an element’s border and padding.

Image One of the principal margin adjustments is to the container 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. You’ll set the top and bottom margins to 20px to give our ...

Get HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.