Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML img border attribute

HTML The border attribute

HTML img Tag Reference HTML tag

Example

An image with a 5-pixel thick border:

Smiley face

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the border attribute.


Definition and Usage

HTML5 does not support The border attribute. Use CSS instead.

In HTML 4.01, The border attribute is deprecated.

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

**Note:** By default, images have no border (unless the image is inside the element).


Compatibility notes

In HTML 4.01, The border attribute is deprecated. Use CSS instead.

CSS syntax:

CSS example: image border

In our CSS tutorial, you can find more details about The border attributedetails.


Syntax

Attribute values

Value Description
pixels The width of the border, in pixels.

HTML img Tag Reference HTML tag