HTML <img> vspaceAttribute
Examples
An image with top and bottom margins of 50 pixels:
<p><img src="smiley.gif.html" alt="Smiley face" width="42" height="42" align="middle" vspace="50">This is some text. This is some text. This is some text.</p>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the vspace attribute.
Definition and Usage
HTML5 does not support the <img> vspace attribute. Please use CSS instead.
In HTML 4.01, the vspace attribute of <img>is deprecated。
The vspace attribute specifies the whitespace at the top and bottom of an image.
Compatibility Notes
In HTML 4.01, the vspace attribute of <img> is deprecated. Please use CSS instead.
CSS Syntax: <img style="margin: 50px 0px">
CSS Example: Image with margins
In our CSS tutorial, you can find more aboutthe margin property'sdetails.
Syntax
<img vspace="pixels">
Attribute Values
| Value | Description |
|---|---|
| pixels | The whitespace at the top and bottom of the image, in pixels. |
HTML <img> Tag Other extensions