HTML bordercolor Attribute
The obsolete bordercolor attribute was historically used by some browsers to specify the color of borders on HTML elements, particularly tables and their cells.
bordercolor attribute is obsolete and should not be used in modern HTML. Use the CSS border-color property instead.
Historical Syntax
The bordercolor attribute was added directly to an element and assigned a color value. It was often used with the border attribute on tables:
<table border="1" bordercolor="blue">
<tr>
<td>Table content</td>
</tr>
</table>
Depending on the browser, a named color or another supported color value could be used to change the color of the displayed border.
Historical Elements
The non-standard bordercolor attribute was historically recognized by some browsers on several elements.
| Element | Historical Purpose |
|---|---|
<table> |
Specified the color of borders displayed around a table and its cells. |
<tr> |
Specified a border color for a table row in browsers that supported the attribute. |
<td>, <th> |
Specified a border color for individual table cells in browsers that supported the attribute. |
Historical Use
The bordercolor attribute provided a way to change border colors directly from HTML. It was commonly associated with older table designs where borders, background colors, spacing, and other visual characteristics were controlled with HTML attributes.
Because bordercolor was not consistently standardized across browsers, its exact appearance and the elements on which it worked could vary between browser implementations.
Why It Became Obsolete
The bordercolor attribute was a presentational feature that mixed visual styling with HTML structure. CSS provides standardized properties for controlling the color, width, and style of borders independently.
CSS also allows border styles to be reused across many elements and provides separate control over each side of an element when more detailed styling is required.
Modern Alternative
Use the CSS border-color property to control border color. A visible CSS border also requires a border style, such as solid.
Historical HTML
<table border="1" bordercolor="blue">
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Garden Gloves</td>
<td>$12.00</td>
</tr>
</table>
Modern HTML and CSS
<table class="colored-border">
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Garden Gloves</td>
<td>$12.00</td>
</tr>
</table>
<style>
.colored-border,
.colored-border th,
.colored-border td {
border-width: 1px;
border-style: solid;
border-color: blue;
}
.colored-border {
border-collapse: collapse;
}
</style>
The CSS border-color property controls only the color of the border. The border-style property determines how the border is drawn, while border-width controls its thickness. The border shorthand property can be used when all three values should be declared together.
Learn More About CSS Borders
The CSS tutorials provide more information about controlling border colors and other border properties:
- CSS Borders - Learn how to set border width, style, and color with CSS.
- CSS Color Values - Learn about the color formats that can be used for borders and other CSS properties.
- CSS Styling Tables - Learn how to apply borders and other styles to HTML tables.
Legacy Browser Support
The bordercolor attribute was recognized by some older browsers, particularly for table-related elements, but it was not a consistently standardized HTML feature. Support and rendering could therefore differ between browser implementations.
Some browsers may continue to recognize historical uses for compatibility with older webpages. Browser recognition does not make bordercolor valid modern HTML, and CSS should be used to control border colors.
For additional information about historical browser compatibility, visit Can I Use? . Search for the HTML element or attribute you want to check. Search results can include related HTML features, element attributes, APIs, and other technologies, so select the result that most closely matches the legacy feature you are researching.
Related Attributes
Other obsolete HTML attributes historically used to control borders and table presentation include:
border- Historically used to request or control visible borders.bgcolor- Historically used to specify a background color.cellpadding- Historically used to control space inside table cells.cellspacing- Historically used to control space between table cells.frame- Historically used to control which outer table borders were displayed.rules- Historically used to control borders between table rows and columns.
Specifications
The bordercolor attribute is not part of modern HTML. Border colors and other presentational border characteristics should be defined with CSS. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.
