The Wayback Machine - https://web.archive.org/web/20240328193402/https://www.geeksforgeeks.org/html-border-attribute/
Open In App

HTML border attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML img border Attribute
    </title>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
 
    <h2>HTML img border Attribute</h2>
 
    <img src=
         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. .  

HTML




<!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=
            height="150px" border="4">
            GeeksforGeeks
        </object>
    </center>
</body>
 
</html>


Output: 
 

Supported Browsers:

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Apple Safari 3.5
  • Opera 1


Last Updated : 18 Jan, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads