Latest web development tutorials

HTML DOM Image border properties

Image Object Reference Image Object

Definition and Usage

border property sets or returns the picture border property values.

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

Note: By default image has no border (unless image itself comes border).

grammar

imageObject.border=pixels


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support border properties


Examples

Examples

Add a picture frame:

<html>
<head>
<script>
function addBorder()
{
document.getElementById("compman").border="2";
}
</script>
</head>
<body>

<img id="compman" src="compman.gif" alt="Computerman">
<br><br>
<input type="button" onclick="addBorder()" value="Add border">

</body>
</html>

try it"


Image Object Reference Image Object