CSS Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
CSS Topics
css tutorials Introduction
Types Types
Background Properties Background Properties
Text Properties Text Properties
Font Properties Font Properties
Box Properties BOX Properties
Border Properties Border Properties
Margin Properties Margin Properties
Padding Properties Padding Properties
Special Topics Special Topics
Forums Ask Your Doubts
Scraps More about CSS
Feedback Feedback
 




CSS Left Padding


Tutorials Css

Topic

How to create space between left border and text?
Left Padding in html using style sheet?



Explanation

Property: Left Padding

Usage:
padding-left: 10px;
padding-left: 10pt;
padding-left: 10%;
padding-left: auto;

Definition:
This will set the left padding of the object.
It takes the following values.
a) pt : You can set values in points. (e.g: 10pt or 100pt).
b) px : You can set values in pixels. (e.g: 10px or 100px).
c) % : You can set values in percentage. (e.g: 10% or 100%).
d) auto : This will set a automatic margin.

Example 1:
<div style="padding-left: 20px;">testing left padding</div>

Result:

testing left padding

Note: The difference between padding and margin is that padding set values inside the objects scope, while margin moves the whole object away from the nearby object.


Example 2:
<div style="padding-left: 30pt;">testing left padding</div>

Result:

testing left padding



Example 3:
<div style="padding-left: 10%;">testing left padding</div>

We don't recommend this as it might cause issues in few browsers like IE


Example 4:
<div style="padding-left: auto;">testing left padding</div>

Result:

testing left padding





A Note
CSS - Cascading Style Sheets can be used along with html tags as explained in this site. This simple CSS will help you to create much elegant and neat html web pages. This does not need any additional softwares or codings. All web browser are capable of handing CSS codes.

Note 2: If required you can using <span> instead of <div> tags. div tag will start and end on new lines. span will not exceed the tag area.
Other Links

web hosting