| Depr. | Version |
|---|---|
| No | HTML 2 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
Description
A visible grid doesn’t appear
around the table cells by default, which has the
potential to make the table quite difficult to read and understand (and
bear in mind that this is a very simple example). In order to create
structure and order around the data that’s presented, use the
border attribute. It applies a border to each cell,
and to the table as a whole.
If we change the value of the
border attribute, from "1" to
"5" for example, the size of the border around the
table will change, but the border inside the table—between the table
cells—won’t change size, as Figure 1
reflects.
Example
The border
for this table is set to "1"
pixel:
<table border="1">
<tr>
<th>Account Type</th>
<th>Interest Rate</th>
</tr>
<tr>
<td>Smart</td>
<td>From 2%</td>
</tr>
<tr>
<td>Young Saver</td>
<td>From 1.6%</td>
</tr>
</table>
Value
This attribute takes a numerical value, which reflects a pixel measurement.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | Chrome | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 8.0 | 1.0 | 1.5 | 2.0 | 3.0 | 3.5 | 1.3 | 2.0 | 3.1 | 4.0 | 9.2 | 9.5 | 10.0 | 2.0 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
The
border attribute isn’t deprecated—it can be used in
a perfectly valid web page. However, although it enjoys full support, it’s
preferable not to specify a border. Instead, use
CSS to apply the border style and color.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.