Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/classes/classdb.php on line 42
Right Padding - CSS (HTML) Tutorial create space between right border and text style sheet

CSS Right Padding

How to create space between right border and text?
How to handle right padding in html using style sheet?

Explanation

Property :

Right Padding

Usage:


padding-right: 10px;
padding-right: 10pt;
padding-right: 10%;
padding-right: auto;

Definition:


This will set the right 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-right: 20px;">testing right padding</div>
Result:

testing right 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-right: 30pt;">testing right padding</div>
Result:

testing right padding


Example 3:


<div style="padding-right: 10%;">testing right padding</div>
We don't recommend this as it might cause issues in few browsers like IE

Example 4:


<div style="padding-right: auto;">testing right padding</div>
Result:

testing right padding



Ask Questions

Ask Question