Thursday, October 7, 2010

CSS: Padding and Margin



Padding is the inner space of an element whereas margin is the outer space of an element.
In another words, padding define the space between the border with the content. Margin defines the space outside the particular HTML element.

Values
We can represent the values in either shorthand or in "full mode"."Full mode"is not that advisable as it makes the code long.


The values are set in clockwise direction.That means the first value represent the space for the top, right, bottom and left accordingly.If there are only 2 values in the code. The first value would represent the space for top and bottom; second value refers to the left and right space.

**For padding, the value is added to the width.Thus, it will influence the layout.**

Reference:
Mastering CSS Coding: Getting Started

No comments:

Post a Comment