Latest web development tutorials

HTML img border properties

HTML img tag Reference Manual HTML <img> tag

Examples

5 pixels thick border with image:

<img src="smiley.gif" alt="Smiley face" border="5">

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support border properties.


Definition and Usage

HTML5 does not support the <img> border property. Use CSS instead.

In HTML 4.01, <img> attribute of the border has been abandoned .

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

Note: By default, the image is no border (unless image <a> internal element).


Compatibility Notes

In HTML 4.01, <img> attribute of the border has been abandoned. Use CSS instead.

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

CSS Example: picture frame

In our CSS tutorial you can find more information about the border attribute details.


grammar

<img border="pixels">

Property Value

描述
pixels 边框的宽度,以像素计。


HTML img tag Reference Manual HTML <img> tag