Adding Padding Around an Element

Padding is just what it sounds like: extra space around the contents of an element but inside the border. Think of Santa Claus’ belly—nicely padded, while being held in by his belt (the border). You can change the padding’s thickness, but not its color or texture. (Margins are Santa’s personal space.)

Figure 11.20. When you set four values for padding, they are assigned to the top, right, bottom, and left, in that order. So, here, there will only be padding on the top and right.

Figure 11.21. When we add padding to the wrap div, we are actually adding padding between its contents (in this case, the screen ...

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.