- HTML Tutorial
- HTML - Home
- HTML - Introduction
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Headings
- HTML - Paragraphs
- HTML - Fonts
- HTML - Blocks
- HTML - Style Sheet
- HTML - Formatting
- HTML - Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - border Attribute
HTML border attribute is used to specify the width of the border around a table element, but it is deprecated in favor of using CSS for styling.
The style and structure of web pages can be improved by using this feature, which is especially helpful for modifying the visual appearance of elements.
Syntax
<tag border = "value"></tag>
Applies On
Below listed elements allow using of the HTML bgcolor attribute.
Element | Description |
---|---|
<img> | HTML <img> tag is used to append images in document |
<table> | HTML <table> tag allow us to arrange data in a organized way by providing row and column facility. |
<object> | HTML <object> is used to show multimedia on web pages, including audio, video, pictures, PDFs, and Flash. |
Examples of HTML border Attribute
Following codes demonstrate the usages of border attribute
Border for table Element
In the following program, we are using HTML 'border' attribute within <table> tag to set the border of the entire table.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML border attribute</title> </head> <body> <!-- Example of the HTML 'border' attribute --> <h3>HTML 'border' attribute with table</h3> <p>User details</p> <table border='1'> <tr> <th>S.No</th> <th>Name</th> <th>Age</th> </tr> <tr> <td>1.</td> <td>Revathi</td> <td>22</td> </tr> <tr> <td>2.</td> <td>Sarika</td> <td>22</td> </tr> </table> </body> </html>
Border to an img Element
Considering the another scenario, where we are going to use the border attribute with the img tag.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML border attribute</title> <style> img { width: 300px; } </style> </head> <body> <!-- Example of the HTML 'border' attribute --> <h3>Example of the HTML 'border' attribute with img</h3> <img src= "https://www.tutorialspoint.com/html/images/html-mini-logo.jpg" border='5'> </body> </html>
Border for object Element
In this program, we are defining the container for external sources using the ‘object’ element. Then, we use the ‘border’ element within the <object> tag to set the border of the ‘object’ element.
<!DOCTYPE html> <html lang="en"> <head> <title>HTML border attribute</title> <style> object { width: 200px; height: 100px; } </style> </head> <body> <!-- Example of the HTML 'border' attribute --> <h3>Example of the HTML 'border' attribute with object</h3> <object data= "https://www.tutorialspoint.com/static/images/simply-easy-learning.png" border='4'> TutorialsPoint </object> </body> </html>
Supported Browsers
Attribute | |||||
---|---|---|---|---|---|
border | Yes | Yes | Yes | Yes | Yes |
To Continue Learning Please Login
Login with Google