Adding Padding around an Element

Padding is just what it sounds like: extra space around the contents of an element but inside the border. You might recall my analogy from before—padding is like the matting between a photo (the content) and a picture frame (the border). You can change the padding’s thickness (Image, Image, and Image) but not its color or texture, but an element’s background color and image do show in the padding area (, , , and ).

Similar to setting ...

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.