Open In App

HTML border attribute

Last Updated : 28 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
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=
"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. .  

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=
"https://www.geeksforgeeks.org/wp-content/uploads/Geek_logi_-low_res.png" width="550px"
            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

Next Article

Similar Reads