HTML <spacer> Tag
The <spacer> tag is used to insert empty spaces on web pages. The tag is obsolete, learn what to use instead.
The <spacer> element is used to insert spaces on the web page. Originally a proprietary Netscape extension, it was deprecated in HTML 4.01 and is now obsolete.
Sometimes you may need to put space into your document. Often this is done with the use of invisible images that can be fully transparent, or have the same color as the background. However, these methods aren’t reliable. To include blank space in a document, you can use the <spacer> element. It is like an image, but actually, there isn’t a picture there.
Specify the type attribute with one of the following values: horizontal, vertical, or block. The block type creates a block-level spacer that spans both dimensions.
Modern browsers don’t support the <spacer> tag. Use CSS margin or padding properties as the standard modern replacement for vertical/horizontal spacing, or the <br> tag instead.
There are many options for adding and controlling blank space on the web page:
- The
<p>tag creates a paragraph break. - The
<br>tag indicates a line break. - The
<pre>tag is used with a preformatted text. It instructs the browser that the text should appear exactly as it is in the HTML file, including blank lines and spaces. - The character creates non-breaking space.
- The
	character creates a tab space in HTML. It typically requires surrounding text or CSS styling (e.g.,white-space: pre) to render visibly. - You can also add space around a text with CSS.
Syntax
The <spacer> tag is empty, which means that the closing tag isn’t required.
Example of the HTML <spacer> tag:
HTML <spacer> Tag
<!DOCTYPE html>
<html>
<head>
<title>Title of the document </title>
<style>
div {
display: block;
text-align: center;
}
</style>
</head>
<body>
<div>
PageUp↑
<br> ←Home
<spacer type="horizontal" width="100" height="100">
End→
<br> PageDown↓
</div>
</body>
</html>Note: This example is for demonstration purposes only. The <spacer> tag is obsolete and will not render in modern browsers.
Result

Attributes
| Attribute | Value | Description |
|---|---|---|
| align | left, right, center | Defines the alignment of the spacer element itself (deprecated). |
| height | height | Defines the height of the empty space in pixels. |
| size | size | Defines the pixel value of the empty space, depending on the type attribute. |
| type | block, horizontal, vertical | Indicates the element type. |
| width | width | Defines the width of the empty space in pixels. |
The <spacer> tag supports the Global Attributes and the Event Attributes.
Practice
What is the function of the HTML spacer tag?