HTML <img> borderAttribute
Example
An image with a 5 pixel thick border:
<img src="smiley.gif.html" alt="Smiley face" border="5">
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the border attribute.
Definition and Usage
HTML5 does not support the <img> border attribute. Please use CSS instead.
In HTML 4.01, the border attribute of <img>is deprecated。
The border attribute specifies the width of the border around an image.
Note:By default, images have no border (unless the image is inside an<a>element).
Compatibility Notes
In HTML 4.01, the border attribute of <img> is deprecated. Please use CSS instead.
CSS syntax: <img style="border:5px solid black">
In our CSS tutorial, you can find more details about theborder propertydetails.
Syntax
<img border="pixels">
Attribute Values
| Value | Description |
|---|---|
| pixels | The width of the border, in pixels. |
HTML <img> Tag Other Extensions