HTML frame Attribute
The obsolete HTML frame attribute was historically used on the <table> element to specify which sides of the table's outer border should be displayed.
frame attribute on the <table> element is obsolete and should not be used in modern HTML. Use CSS border properties to control the outer borders of a table.
Historical Syntax
The frame attribute was placed on a <table> element and accepted a keyword that specified which parts of the table's outer border should appear:
<table frame="box">
...
</table>
For example, the value box requested borders on all four sides of the table.
Historical Elements
The obsolete frame attribute was associated with the <table> element.
| Element | Historical Purpose |
|---|---|
<table> |
Specified which sides of the table's outer border should be displayed. |
Historical Use
The frame attribute provided several values for controlling the outer border of a table.
| Value | Historical Effect |
|---|---|
void |
Displayed no outer border. |
above |
Displayed a border along the top of the table. |
below |
Displayed a border along the bottom of the table. |
hsides |
Displayed borders along the top and bottom of the table. |
vsides |
Displayed borders along the left and right sides of the table. |
lhs |
Displayed a border along the left side of the table. |
rhs |
Displayed a border along the right side of the table. |
box |
Displayed borders around all four sides of the table. |
border |
Displayed borders around all four sides of the table. |
The frame attribute controlled the table's outer border. It was different from the obsolete rules attribute, which controlled borders between rows, columns, or groups within the table.
Why It Became Obsolete
The frame attribute controlled visual presentation rather than the meaning or structure of the table. As CSS became the standard method for styling webpages, presentational table attributes such as frame were no longer needed.
CSS provides much greater control because each side of a table can have its own border width, style, and color. These styles can also be reused across multiple tables without repeating presentational attributes in the HTML.
Modern Alternative
Use CSS border properties instead of the obsolete frame attribute. The border, border-top, border-right, border-bottom, and border-left properties can reproduce the different outer-border arrangements historically requested by frame.
Historical HTML
<table frame="hsides">
...
</table>
Modern HTML and CSS
<table class="horizontal-borders">
...
</table>
<style>
.horizontal-borders {
border-top: 2px solid #000;
border-bottom: 2px solid #000;
}
</style>
The modern CSS example places borders only along the top and bottom of the table, producing the basic visual effect historically requested with frame="hsides".
Learn More About CSS Borders
The CSS tutorials explain how to control table borders and individual border properties:
- CSS Borders - Learn how to control an element's border width, style, and color with CSS.
- CSS Styling Tables - Learn how CSS is used to style HTML tables.
Legacy Browser Support
The frame attribute was historically supported as part of older HTML table presentation features, although the exact appearance could vary according to browser rendering.
Modern browsers may continue to recognize some legacy table markup for compatibility with older webpages, but new and updated webpages should use CSS for table borders.
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 table borders and spacing include:
border- Historically used to specify a border around a table and other elements.bordercolor- Historically used to specify the color of borders.cellpadding- Historically used to control spacing between table cell content and cell borders.cellspacing- Historically used to control spacing between table cells.rules- Historically used to control borders between rows, columns, and groups within a table.
Specifications
The frame attribute on the <table> element is obsolete and table borders should be controlled with CSS. See the WHATWG HTML Living Standard for information about obsolete and non-conforming features.
