| Depr. | Version |
|---|---|
| No | HTML 4 |
| IE8 | FF3.5 | SA4 | OP10 | CH2 |
|---|---|---|---|---|
| None | None | None | None | None |
Syntax
Description
The
axis attribute provides a mechanism for grouping
related columns or rows of information. In the example above, there are
four pieces of information, but the email and phone details could be
grouped together as actual points of contact. The intention of the
axis attribute’s application in a
th is that it allows the grouping of sections in tables
which contain quite a lot of information, making it possible to
extrapolate this information using some kind of query—particularly where
assistive technology is concerned. It’s very easy for a sighted user to
scan down those columns to find what’s required, but this may be difficult
for non-visual browsers in the context of a larger
table.
Example
In this example, four
table headers are grouped into three categories—name, contact, and
location—using axis:
<table border="1">
<tr>
<th colspan="4">Work Contact Points</th>
</tr>
<tr>
<th axis="name">Name</th>
<th axis="contact">Email</th>
<th axis="contact">Phone</th>
<th axis="location">Floor/Block</th>
</tr>
<tr>
<td>Fred</td>
<td>fred@megacorp.com</td>
<td>123456</td>
<td>1/A</td>
</tr>
⋮
</table>
Value
This attribute takes as its value any name that the developer chooses, provided it doesn’t contain any spaces or special characters.
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 |
| None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None | None |
All the talk of intentions and possibilities in this
attribute’s description should have alerted you to the fact that, despite
the good intentions of axis, this is not an
attribute that has enjoyed great success to date. It’s not supported in
any of the current browsers, and questions surround its practical
applications. For example, how would one actually query the table
data?
To ensure that your table markup is as accessible
as possible and provides the greatest amount of orientation for users of
assistive devices, it’s best to use the scope attribute for simple tables that have no need of colspan and rowspan attributes, or a combination of headers and id attributes for more
complex tables. Only apply the axis attribute if it
creates minimal overhead, and if you’re sure that you can avoid a
maintenance load in the future. Attributes that are invisible on the
rendered page are the most likely to suffer from maintenance
rot!
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.