HTML bottommargin Attribute

The obsolete bottommargin attribute was historically used with the <body> element to specify the amount of space between the document content and the bottom edge of the browser viewport.

Historical Syntax

The bottommargin attribute was added to the <body> element and assigned a numeric value representing the bottom margin:

<body bottommargin="20">

In browsers that supported the attribute, the value controlled the amount of space left at the bottom of the document.

Historical Elements

The bottommargin attribute was historically associated with the <body> element.

Element Historical Purpose
<body> Specified the amount of space between the document content and the bottom edge of the browser viewport.

Historical Use

The bottommargin attribute provided a browser-specific way to control spacing around the document body. It was commonly used with similar attributes that controlled the top, left, and right document margins.

Because these attributes were not consistently standardized across browsers, older webpages sometimes included several different margin attributes in an attempt to produce similar spacing in different browser implementations.

Why It Became Obsolete

The bottommargin attribute controlled visual presentation directly from HTML and was not part of the standardized approach to document styling. CSS provides a consistent way to control spacing around the document and individual elements.

CSS also provides separate margin and padding properties for each side of an element, allowing precise control without browser-specific HTML attributes.

Modern Alternative

Use CSS to control spacing at the bottom of the document. Depending on the desired layout, margin-bottom or padding-bottom can be used.

Historical HTML

<body bottommargin="40">
  <h1>Page Heading</h1>
  <p>Page content</p>
</body>

Modern HTML and CSS

<body>
  <h1>Page Heading</h1>
  <p>Page content</p>
</body>

<style>
body {
  margin-bottom: 40px;
}
</style>

The CSS margin-bottom property creates space outside the bottom edge of an element. The padding-bottom property creates space inside the element between its content and bottom edge. Which property is appropriate depends on the layout and the type of spacing required.

Play in Editor

Learn More About CSS Spacing

The CSS tutorials provide more information about controlling margins and padding:

  • CSS Margins - Learn how margins create space outside an element.
  • CSS Padding - Learn how padding creates space between an element's content and its edges.
  • CSS Box Model - Learn how content, padding, borders, and margins form the CSS box model.

Legacy Browser Support

The bottommargin attribute was recognized by some older browsers as a way to control the bottom margin of the document body. It was a browser-specific presentational feature rather than a standard method of controlling webpage layout.

Browser recognition of the bottommargin attribute does not make it valid modern HTML. When maintaining older source code, replace it with the appropriate CSS margin or padding property.

For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.

Other obsolete attributes historically used to control margins and spacing around the document body include:

  • topmargin - Historically used to control the top document margin.
  • leftmargin - Historically used to control the left document margin.
  • rightmargin - Historically used to control the right document margin.
  • marginheight - Historically used to control vertical margins in frames and inline frames.
  • marginwidth - Historically used to control horizontal margins in frames and inline frames.

Specifications

The bottommargin attribute is not part of modern HTML. Document spacing should be controlled with CSS. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.