Monday, December 17, 2012

Padding

Padding is a property used in CSS to fix the content of the division at a particular distance from the borders.
Lets take up a simple example :
.padd{
border:3px solid red;
}
The above code's result will be like this.
A bit altered :
.padd{
border:3px solid red;
padding:10px;
}
The above code's result will be like this. Here the content is 10px away from each border.
.padd{
border:3px solid red;
padding:20px 10px;
}
The above code's result will be like this. Here the content is 10px away from left and right borders and 20px away from top and bottom borders. Changing the places of 10 and 20 px in the code would get a reverse effect.
Therefore, padding has four attributes :
  1. padding-top
  2. padding-bottom
  3. padding-left
  4. padding-right

No comments :

Post a Comment