O'Reilly logo

HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition by Bruce Hyslop, Elizabeth Castro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required