CSS Margin And Padding Elements

When you set the margin around an element, you are adding invisible space to either the top, bottom, right, or left side of the element. The visitors of your web page will not see this space.

To set the margin of an element:

NameOfElement {margin-side: Xpx}. Where side can either be, top, bottom, right, or left, and X will be the value of the margin in pixels. You can also use percentages instead of pixels.

Like a margin, when you add padding to an element you are also adding some extra space around its contents.

To add padding to an element:

NameOfElement {padding-side: Xpx}. Where side can either be top, bottom, right, or left, and X will be the value of the padding in pixels. Again you can also use percentages.

Next: CSS Adding A Border

Template Design | Elque 2007