Last Updated : 12 Jul, 2025
The HTML border attribute is used to set the visible border width to most HTML elements within the body.
Note: The HTML border attribute is not supported in HTML5.
Syntax:<tag border="value">Supported tags:
Example 1: In this example, we will see code for the table border attribute in an HTML document.
HTML
<!DOCTYPE html>
<html>
<head>
<title>
HTML table border Attribute
</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML table border Attribute</h2>
<table border="1">
<caption>Author Details</caption>
<tr>
<th>NAME</th>
<th>AGE</th>
<th>BRANCH</th>
</tr>
<tr>
<td>BITTU</td>
<td>22</td>
<td>CSE</td>
</tr>
<tr>
<td>RAM</td>
<td>21</td>
<td>ECE</td>
</tr>
</table>
</body>
</html>
Output:
Example 2: In this example, we will see code for Image border attribute in an HTML document.
<!DOCTYPE html>
<html>
<head>
<title>
HTML img border Attribute
</title>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML img border Attribute</h2>
<img src=
"https://media.geeksforgeeks.org/wp-content/uploads/20190506164011/logo3.png"
alt="GeeksforGeeks logo"
border="5">
</body>
</html>
Output:
Example 3: In this example, we will see code for Object border attribute in an HTML document. .
<!DOCTYPE html>
<html>
<head>
<title>
HTML object border Attribute
</title>
</head>
<body>
<center>
<h1>GeeksForGeeks</h1>
<h1>
HTML <object> border Attribute
</h1>
<br>
<object data=
"https://www.geeksforgeeks.org/wp-content/uploads/Geek_logi_-low_res.png" width="550px"
height="150px" border="4">
GeeksforGeeks
</object>
</center>
</body>
</html>
Output:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4