3 out of 5 rated this helpful - Rate this topic

padding-top property

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

CSS 2.1, Section 5.5.6

Syntax

padding-top: <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-top attribute and the padding-top property to change the padding of the object.

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

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


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

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

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


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

See also

CSSStyleDeclaration
currentStyle
defaults
runtimeStyle
style

 

 

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.