Export (0) Print
Expand All
top
Expand Minimize

padding

Sets the amount of space to insert between the object and its margin or, if there is a border, between the object and its border.

Syntax

{ padding: sPadding }

Possible values

sPadding

String that specifies one of the following 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 Length units reference.

percentage

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

The property has a default value of 0 for all objects. It is not inherited.

Remarks

This is a composite property that specifies up to four padding values, in the following order: top, right, bottom, left. If one width value is specified, it is used for all four sides. If two width values are specified, the first is used for the top and bottom borders, and the second is used for left and right borders. If three width values are specified, they are used for top, right/left, and bottom borders, respectively. Negative values are not allowed.

Examples

The following example uses the padding property to change the padding of the object. This example uses the TD object as a selector and padding1 as a class in an embedded style sheet to set the padding for the TD object:

<style>
    td {padding:3mm 8mm}
    .padding1  {padding:1cm}
</style>
</head>
<body>
<table border >
    <td onmouseover="this.className='padding1'"
        onmouseout="this.className=''" align=middle>
    <img src="sphere.jpg">
    </td>
</table>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371235.xtlink_newWindow(en-us,Expression.40).png.

Applies to

a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, del, dfn, div, dl, dt, em, embed, fieldset, font, form, frame, hn, hr, i, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, ins, li, nextid, object, ol, p, q, rt, ruby, s, select, span, sub, table, td, th, tt, u, ul, var, xmp

See also

Concepts

margin

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2014 Microsoft