Export (0) Print
Expand All
top
Expand Minimize

margin-bottom

Sets the height of the bottom margin of the object.

Syntax

{ margin-bottom: sHeight }

Possible values

sHeight

Variant that specifies or receives one of the following values:

auto

Default. Bottom margin is set equal to the top margin.

height

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 height of the parent object.

The property has a default value of auto and is not inherited.

Remarks

For inline elements, the value of this property is used to compute the border area of a surrounding inline element, if it is present. This value does not contribute to the height of a line.

Negative margins are supported, except for top and bottom margins on inline objects.

Examples

The following example uses the margin-bottom property to change the margin of the object. This example uses the HR element as a selector and margin1 as a class in an embedded style sheet to set the top margin of the horizontal rule:

<style>
    hr { margin-bottom: 2cm; }
    .margin1 { margin-bottom: 4cm; }
</style>
</head>
<body>
<hr onclick="this.className='margin1'" ondblclick="this.className=''">
</style>

This example uses inline scripting to set and reset the margin when the onclick and ondblclick events occur, respectively:

<hr onclick="this.style.margin-bottom='2cm'" 
ondblclick="this.style.margin-bottom=''">

Standards information

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

Applies to

a, abbr, acronym, b, bdo, big, blockquote, body, button, caption, center, cite, code, custom, dd, defaults, del, dfn, div, dl, dt, em, embed, fieldset, font, form, hn, hr, i, iframe, 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, object, ol, p, q, s, span, sub, table, td, th, tt, u, ul, var, xmp

See also

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

Community Additions

ADD
Show:
© 2014 Microsoft