Image borderProperty
Image Object
Definition and Usage
The border property sets or returns the value of the border attribute of an image.
The border property specifies the width of the border around an image.
Note:By default, images have no border (unless the image itself comes with a border).
Syntax
imageObject.border=pixels
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the border property.
Example
Example
Add a border to an image:
<html>
<head>
<script>
function addBorder()
{
document.getElementById("compman").border="2";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif.html" alt="Computerman">
<br><br>
<input type="button" onclick="addBorder()" value="Add border">
</body>
</html>
<head>
<script>
function addBorder()
{
document.getElementById("compman").border="2";
}
</script>
</head>
<body>
<img id="compman" src="compman.gif.html" alt="Computerman">
<br><br>
<input type="button" onclick="addBorder()" value="Add border">
</body>
</html>
Try it Yourself »
Image Object Other Extensions