FANDOM


The padding-left property is used in CSS and certain HTML tags. It can only be used with an available background-color or background-image property, as it provides the information of the padding on the left side of the background color or image around the text. Its values can be entered in pixels or percentages. Pixels generate more accurate results, where percentages often make the padding too large. To specify padding around the entire object, use padding. To specify a different padding for each side of the object, use padding-top, padding-bottom, or padding-right.

To apply this in an HTML document, use:

Pixels

<span style="background-color:black; color:white; padding-left:5px;">Padded text.</span>

That will produce: Padded text.


Percentages

<span style="background-color:black; color:white; padding-left:2%;">Padded text.</span>

That will produce: Padded text.


To apply this in CSS, in the h1 element for example, use:

h1 {
     background-color:black;
     color:white;
     padding-left:5px;
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.