Latest web development tutorials

HTML table border properties

HTML table tag Reference Manual HTML <table> tag

Examples

The following HTML table will display a border around the table cell:

<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support border properties.


Definition and Usage

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

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


Differences between HTML 4.01 and HTML5

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


grammar

<table border="1">

Property Value

描述
"" 表格单元周围没有边框(表格可用于布局目的)。
"1" 在表格单元周围添加边框(表格不用于布局目的)。


HTML table tag Reference Manual HTML <table> tag