6 out of 7 rated this helpful - Rate this topic

padding-left property

Sets or retrieves the amount of space to insert between the left border of the object and the content.

CSS 2.1, Section 5.5.9

Syntax

padding-left: <length> | <percentage>

Property values

length

Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px). For more information about the supported length units, see CSS Values and Units Reference.

percentage

Integer, followed by a percent sign (%). The value is a percentage of the width of the parent object.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Value0

Standards information

Remarks

As of Microsoft Internet Explorer 5.5, this property applies to inline elements. With earlier versions of Windows Internet Explorer, inline elements must have an absolute position or layout to use this property. Element layout is set by providing a value for the height property or the width property.

Negative values are not allowed.

Examples

The following examples use the padding-left attribute and the padding-left property to change the padding of the object.

This example uses td as a selector in an embedded style sheet to set the left padding for all table cells to 1 centimeter.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/padding-left.htm


<STYLE>
    TD { padding-left:1cm }
</STYLE>

This example uses inline scripting to set the cell's left padding to 1 centimeter when an onmouseover event occurs.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/paddingLeft.htm


<TD onmouseover="this.style.paddingLeft='1cm'"
    onmouseout="this.style.paddingLeft=''">
    <IMG src="sphere.jpg">
</TD>

See also

CSSStyleDeclaration
currentStyle
defaults
runtimeStyle
style
CSS Enhancements in Internet Explorer 6

 

 

Send comments about this topic to Microsoft

Build date: 11/29/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.