Skip to content

<spacer> - Whitespace Control (Deprecated)

Deprecated Non-standard

The <spacer> element was a Netscape-only proprietary tag introduced in Netscape Navigator 3.0 for adding blank space to web pages. It allowed developers to insert horizontal space, vertical space, or block-level spacing without using images or CSS (which was less mature at the time).

This element never gained widespread adoption, was never standardized, and has been completely removed from all modern browsers.

<!-- Never use this! For reference only -->
<spacer type="horizontal" size="20">
<spacer type="vertical" size="50">
<spacer type="block" width="100" height="50" align="left">

These attributes only worked in old versions of Netscape Navigator:

AttributeDescriptionValues
typeType of spacinghorizontal, vertical, block
sizeSize of space (for horizontal/vertical)Number (pixels)
widthWidth of space (for block type)Number (pixels)
heightHeight of space (for block type)Number (pixels)
alignAlignment (for block type)left, right, center

Adds horizontal space inline with text, similar to adding extra spaces between words.

Text<spacer type="horizontal" size="50">More text
<!-- This code does nothing in modern browsers -->
<p>Start of text
<spacer type="horizontal" size="50">
spaced text</p>
<spacer type="vertical" size="30">
<p>This paragraph would have been pushed down</p>
<spacer type="block" width="200" height="100" align="left">
<p>This would flow around the block space</p>

The <spacer> element was deprecated and removed for several important reasons:

  1. Never Standardized: Only worked in Netscape Navigator, never in Internet Explorer or other browsers
  2. CSS Does It Better: CSS provides far more flexible and powerful spacing control
  3. Violated Separation of Concerns: Presentation (spacing) should be handled by CSS, not HTML
  4. Limited Functionality: Couldn’t respond to viewport changes or user preferences
  5. Accessibility Issues: Added visual spacing without semantic meaning
  6. Browser Compatibility: Created websites that looked broken in non-Netscape browsers

All spacing that <spacer> attempted to achieve can be done better with CSS.

The most common and recommended approach for adding space:

Result

The modern, preferred way to add space between flex items:

Result

Perfect for creating consistent spacing in grid layouts:

Result

For adding space between inline elements:

Result
Result

If you encounter legacy code using <spacer>, here’s how to migrate:

Old (Netscape only):

Text<spacer type="horizontal" size="50">More text

New (CSS):

<style>
.spaced {
margin-right: 50px;
display: inline-block;
}
</style>
<span class="spaced">Text</span>More text
  1. Use CSS Gap: For flex and grid layouts, gap is the cleanest solution
  2. Use Margin: For spacing around elements
  3. Use Padding: For spacing inside elements
  4. Avoid Empty Elements: Don’t create empty <div> elements just for spacing
  5. Use Logical Properties: Consider margin-block-end instead of margin-bottom for better internationalization
  6. Responsive Spacing: Use relative units (rem, em) or responsive values
Result
BrowserVersionSupport
Netscape Navigator3.0 - 4.xSupported
Internet ExplorerAllNever supported
ChromeAllNever supported
FirefoxAllNever supported
SafariAllNever supported
EdgeAllNever supported

The <spacer> element only ever worked in Netscape Navigator 3.0 through 4.x (released 1996-1997). When Netscape 6 switched to the Gecko engine in 2000, support was dropped.


Line break element for breaking text to a new line. While valid, consider CSS for most spacing needs. Learn more →

Generic container for flow content. Use with CSS for layout and spacing. Learn more →

Generic inline container. Use with CSS margin for inline spacing. Learn more →

CSS Box Model

Learn about margin, padding, and modern spacing techniques.

The <spacer> element was never part of any W3C or WHATWG specification. It was a proprietary Netscape extension that was never standardized.

References: