Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Css padding (Css tutorial)

Hello guys! evening and welcome to this section of my tutorial on CSS. In this tutorial i want to talk about CSS Paddings.

The padding property allows you to specify how much space should appear between the content of an element and its border:

The value of this attribute should be either a length, a percentage, or the word inherit. If the value is inherit, it will have the same padding as its parent element. If a percentage is used, the percentage is of the containing box.

The following CSS properties can be used to control lists. You can also set different values for the padding on each side of the box using the following properties:
  • The padding-bottom specifies the bottom padding of an element.
  • The padding-top specifies the top padding of an element.
  • The padding-left specifies the left padding of an element.
  • The padding-right specifies the right padding of an element.
  • The padding serves as a shorthand for the preceding properties.
Now, lets take a look at how to make use of these properties with few examples.

The padding-bottom Property
The padding-bottom property sets the bottom padding of an element. This can take a value in terms of length of %.
 
Below is a short example:


This is a paragraph with a specified bottom padding.



This is another paragraph with a specified bottom padding in percent.


You can also read: Fonts (Css tutorial)

The padding-top Property
The padding-top property sets the top padding of an element. This can take a value in terms of length of %.
 
Below is a short example:


This is a paragraph with a specified top padding.



This is another paragraph with a specified top padding in percent.


You can also read: Html Document structure

The padding-left Property
The padding-left property sets the left padding of an element. This can take a value in terms of length of %.
 
Below is a short example:


This is a paragraph with a specified left padding.



This is another paragraph with a specified left padding in percent.


You can also read: Html - Text Links

The padding-right Property
The padding-right property sets the right padding of an element. This can take a value in terms of length of %.
 
Below is a short example:


This is a paragraph with a specified right padding.



This is another paragraph with a specified right padding in percent.


The Padding Property
The padding property sets the left, right, top, bottom padding of an element. This can take a value in terms of length of %.

Below is a short example:


all four padding will be 10px.



top and bottom padding will be 10px, while the left and right padding will be 3% of the total width of the document.



top padding will be 10px, while the left and right padding will be 3% of the total width of the document, and lastly the bottom padding will be 10px.



top padding will be 10px, right padding will be 3% of the total width of the document, and lastly the bottom padding and top padding will be 10px.


Alright thats it for this tutorial on CSS paddings, always feel free to ask your questions in areas you don't understand very well, your questions will be attended to as soon as possible.
Like our facebook page and also subscribe with us to get our tutorial posts delivered directly to your emails.
You can follow us on twitter 
You can follow us on google+
You can also follow us on pinterest 

Links to previous tutorials on CSS : Css Introduction (Css tutorial) ,  Syntax (Css tutorial)  ,  Inclusion (Css tutorial) , Css Measurement Units (Css tutorial)  , Backgrounds (Css tutorial) , Fonts (Css  tutorial)  , Text (Css tutorial)  , Images (Css tutorial)  , Links (Css tutorial) , Css table (Css tutorial) , Css border (Css tutorial)  , Css margin (Css tutorial)  , Css List (Css tutorial)


This post first appeared on Web Design Tutorialz, please read the originial post: here

Share the post

Css padding (Css tutorial)

×

Subscribe to Web Design Tutorialz

Get updates delivered right to your inbox!

Thank you for your subscription

×