Compartilhar via


paddingTop property

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

 

Syntax

Integer value = object.put_paddingTop(Variant v);Integer value = object.get_paddingTop(Variant* sPadding);

Property values

Type: VARIANT

percentage (percentage)

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

String format

<length> | <percentage>

CSS information

Applies To All elements
Media visual
Inherited no
Initial Value 0

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 IHTMLRuleStyle::position or layout to use this property. Element layout is set by providing a value for the IHTMLRuleStyle::height property or the IHTMLRuleStyle::width property.

Negative values are not allowed.

Examples

In the following example, two div elements each contain text and specify IHTMLRuleStyle::width and IHTMLRuleStyle::border values. The second div element also specifies a IHTMLRuleStyle::paddingTop value.

<div id="noPadding">
   Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="paddingTop">
   Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
#noPadding {
   width: 200px;
   border: .5em solid #BBBBBB;
}
#paddingTop {
   width: 200px;
   border: .5em solid #BBBBBB;
   padding-top: 20px;
}

The following image shows the first div element without any padding.

The following image shows the second div element with a IHTMLRuleStyle::paddingTop value of 20 pixels.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll