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

HTML Reference Manual

Complete List of HTML Tags

HTML: <img> border attribute

The border attribute specifies the width of the border around the image. By default, images have no border.

 HTML <img> tag

Online Example

With3Image with thick border:

!DOCTYPE html
<html>
<head>
<title>HTML:<img> border attribute - 基础教程网 oldtoolbag.com</title>
<body>
<img src="haha.gif" alt="haha face" width="42" height="42" border="3">
</body>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

The border attribute is deprecated, but still supported in all major browsers.

Definition and usage

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

In HTML 4.01 In this example, the <img> border attribute is deprecated.

The border attribute specifies the width of the border around the image.

Note:By default, images do not have a border (unless the image is in <a> inside the element).

Compatibility notes

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

CSS Syntax: <img style="border:5px solid black">

CSS Example: Image border

In our CSS tutorial, you can find more about border attribute. Details.

Syntax

<img border="pixels">

Attribute value

ValueDescription
pixelsBorder width in pixels.
 HTML <img> tag