The border property sets the border of an element.
The border of the image can be specified by applying this property to the IMG element.
img {
border: 2px red solid;
}
| Property | Value | Explanation |
|---|---|---|
| border | each value | sets width, color, and style |
When an image is used as a link, the browser will automatically display a border of the image. If you want to rid the image of the border, specify "none" for the value.
border: none;
<html> <head> <title>TAG index</title> <style type="text/css"> #example { border: 5px red solid; } a img { border: none; } </style> </head> <body> <p><img src="image/photo.jpg" alt="Example" width="200" height="133" id="example"></p> <p><a href="index.html"><img src="image/photo.jpg" alt="Example" width="200" height="133"></a></p> </body> </html>