English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <img> vspace attribute

This article introduces the usage of the HTML img vspace attribute, online examples demonstrate how to use the HTML img vspace attribute, browser compatibility, syntax definition, and detailed information about its attribute values.

 HTML <img> tag

Online examples

Top and bottom margins are 38 Pixel images:

!DOCTYPE html
<html>
<head>
<title>HTML: <img> vspace attribute - Basic Tutorial Website oldtoolbag.com</title>
<body>
<h4>Images without vspace:</h4>
<p><img src="smiley.gif" alt="Smiley face" width="42" height="42" align="middle"> This is some text. This is some text. This is some text.</p>
<h4>Images with vspace:</h4>
<p><img src="smiley.gif" alt="Smiley face" width="42" height="42" align="middle" vspace="38">This is some text. This is some text. This is some text.</p>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the vspace attribute.

Definition and Usage

HTML5 The <img> vspace attribute is not supported. Please use CSS instead.

In HTML 4.01 The vspace attribute of <img> is deprecated in HTML.

The vspace attribute specifies the whitespace at the top and bottom of the image.

Compatibility notes

In HTML 4.01 In this example, the vspace attribute of <img> is deprecated. Please use CSS instead.

CSS Syntax: <img style="margin: 50px 0px">

CSS Example: Image with Margin

In our CSS tutorial, you can find more about margin property. Details.

Syntax

<img vspace="pixels">

Attribute value

ValueDescription
pixelsWhitespace at the top and bottom of the image, in pixels.
 HTML <img> tag