HTML - <spacer> Tag



HTML <spacer> tag is used to specify a whitespace on the web pages by replacing the effect of adding small image. We can use this tag to create blank space if we needs to, however this tag is not reliable or future proof as it is removed in HTML5.

This tag is deprecated in HTML5, we can use HTML <pre> or <br> tag according to the needs or we can use CSS margin or padding property to generate white space around the small images or where we need.

Syntax

<spacer type="" size="">

Attribute

HTML spacer tag supports Global and Event attributes of HTML. Accepts some specific attributes as well which are listed below.

Attribute Value Description
type vertical
horizontal
block
Specify whether the spacer will be horizontal, vertical, or block(Deprecated).
size number Specifies the number of pixels tall or wide the spacer will be This attribute is only used if the spacer type is "horizontal" or "vertical." If the spacer type is "block," then the width attribute is used(Deprecated).
width number The width attribute is used when the spacer type = "block". Between the quotes specify a pixel value for the width of the block(Deprecated).
height number The height attribute is used when the spacer type = "block". Between the quotes specify a pixel value for the height of the block(Deprecated).
align left
right
center
The align tag is used to specify the alignment of the block of white space. Valid alignments are left, right, and center(Deprecated).

Examples of HTML spacer Tag

Bellow examples will illustrate the usage of spacer tag. Where, when and how to use spacer tag to create whitespace.

Create Whitespace on Paragraph

Consider the following example, where we are going to use the spacer tag to create white space at a certain place of the pragrapgh.

<!DOCTYPE html>
<html>

<head>
   <title>HTML spacer Tag</title>
</head>

<body>
   
   

Create some space <spacer type = "block" width = "50" /> here.

</body> </html>

Create Whitespace on Images

Consider the following example, where we are going to use the spacer tag to create white space on around the image.

<!DOCTYPE html>
<html>

<head>
   <title>HTML spacer Tag</title>
</head>

<body>
   
   <img src="/html/images/html-mini-logo.jpg" alt="HTML Logo">
</body>

</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
spacer No No No No No
html_deprecated_tags.htm
Advertisements