The HTML border attribute is used to set visible border width to most HTML elements within the body.
Syntax:
<tag border="value">
Note: HTML border attribute is not supported in HTML5.
Supported tags:
Example: table border attribute.
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: Img border attribute.
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: Object border attribute.
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 =
width = "550px" height = "150px" border = "4" >
GeeksforGeeks
</ object >
</ center >
</ body >
</ html >
|
Output:

Supported Browsers: The browsers supported by HTML border attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
01 Jun, 2022
Like Article
Save Article