border (HTML attribute)

Spec
Depr. Version
Yes HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

border="number"

Description

By default, an image will display without a border (unless it’s contained inside an a element and CSS has not been used to remove the border). The border attribute rectifies this, and allows you to specify a border in pixels. Depending on the browser, the border will either be black, or will match the color of the document’s text.

Figure 1. An image with a border thickness of five pixels An image with a border thickness of 5 pixels

Example

This border attribute is set to "5":

<img src="giant-prawn.jpg" alt="The Giant Prawn at Ballina"
    border="5"/>

Value

This attribute takes as its value a number that represents the width of the border in pixels.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

Although support for this attribute is good, it’s now deprecated, and is highly presentational in its nature. The desired visual effects can all be achieved with CSS and, as such, this attribute shouldn’t be used—it’s presented here for informational purposes only.

User-contributed notes

There are no comments yet.

Related Products