HTML <spacer> Element

The <spacer> element was a non-standard HTML element introduced by Netscape to insert empty space between elements on a webpage. Authors could use it to create horizontal, vertical, or block-shaped areas of blank space when controlling page layouts.

Historical Syntax

Older webpages designed for Netscape could contain markup similar to the following:

<p>First section of content.</p>

<spacer type="vertical" size="30">

<p>Second section of content.</p>

In a browser that supported the element, the <spacer> inserted an empty area between the two sections of content. The size and direction of the space could be controlled with attributes. This code is shown for historical reference only and should not be used in modern HTML.

Attributes

The non-standard <spacer> element used several attributes to determine the type and dimensions of the empty space it created.

Attribute Description
align Controlled the alignment of a block spacer relative to surrounding content.
height Specified the height of a block spacer.
size Specified the amount of horizontal or vertical space created by the spacer.
type Specified the type of spacer, historically using values such as horizontal, vertical, or block.
width Specified the width of a block spacer.

Historical Use

The <spacer> element appeared during a period when HTML authors had few reliable tools for controlling the exact spacing and positioning of page content. It offered a simple way to insert blank areas without relying on repeated non-breaking spaces, empty paragraphs, or transparent images.

A horizontal spacer could separate content across a line, while a vertical spacer could add space between content above and below it. A block spacer could reserve a rectangular area with specified width and height.

Although this could be convenient for visual page design, the element was a proprietary Netscape extension and was never part of the HTML standard. Pages that depended on it could therefore behave differently in browsers that did not implement the element.

Why It Became Obsolete

The <spacer> element existed entirely for visual presentation rather than describing the structure or meaning of webpage content. As CSS became widely supported, spacing could be controlled separately from the HTML markup.

CSS provides much more precise and flexible spacing with properties such as margin, padding, and gap. Flexbox and Grid also provide methods for distributing and aligning space between layout items without inserting empty HTML elements.

Because <spacer> was non-standard and its functionality belongs in CSS, it has no place in modern HTML.

Modern Alternative

Use CSS margin when space is needed outside an element:

<div class="section">
  <p>First section of content.</p>
</div>

<div>
  <p>Second section of content.</p>
</div>
.section {
  margin-bottom: 30px;
}

Use padding when space is needed inside an element between its content and its boundary. For groups of items arranged with Flexbox or Grid, the gap property provides a convenient way to control the space between them.

Unlike an empty spacer element, CSS spacing can be adjusted for different screen sizes without adding meaningless elements to the HTML document.

Play in Editor

Legacy Browser Support

The <spacer> element was introduced as a proprietary Netscape extension and was never standardized as part of HTML. Historical browser support therefore varied, and modern browsers should not be expected to reproduce its original spacing behavior consistently.

Even when a browser recognizes the element in old markup, that recognition does not make <spacer> valid or suitable for modern webpages. Existing spacer elements should be removed and their intended spacing recreated with CSS.

Modern HTML does not require an element solely for creating empty space. Structural elements such as the <div> and <section> elements can identify meaningful parts of a document, while CSS controls the margin, padding, gap, and layout around them.

Specifications

The <spacer> element originated as a proprietary Netscape extension and was never a standard HTML element. It is listed as an entirely obsolete, non-conforming feature in the WHATWG HTML Living Standard . Authors should use CSS for spacing and layout instead.