English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML table border attribute

The border attribute specifies whether to display a border around the table cell.

 HTML <table> tag

Online Example

The following HTML table will be displayed with borders around the table cells:

<table border="1">
  <tr>
    <th>Name</th>
    <th>Credits</th>
  </tr>
  <tr>
    <td>Zhang San</td>
    <td>90</td>
  </tr>
  <tr>
    <td>Li Si</td>
    <td>87</td>
  </tr>
</table>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the border attribute.

Definition and Usage

The border attribute specifies whether a border is displayed around the table cell.

Value "1" indicates that the border should be displayed, and the table is not used for layout purposes.

HTML 4.01 and HTML5differences between

In HTML5 In HTML, the border attribute is used only to indicate whether the table is used for layout purposes, and only allows attribute values "" or "1".

Syntax

<table border="1">

Attribute value

ValueDescription
""There is no border around the table cell (the table can be used for layout purposes).
"1"Add a border around the table cell (the table is not used for layout purposes).
 HTML <table> tag