Access 5.5.2.1

From Htmlpedia
Jump to: navigation, search

Access: [5.5.2.1]: <table> missing <caption> (Priority 2)

Cause:

Captions are used to describe the nature of the table in one to three sentences. Insert the caption below the table element. A caption is not always necessary. If a caption is not provided, use the "title" attribute to briefly describe the purpose of a table.

Example:

Bad
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/5.5.2</title>
</head>
<body>

<table summary="This simple data table has no caption.">

        <tr><td>1</td><td>2</td></tr>
        <tr><td>3</td><td>4</td></tr>

</table>
</body>
</html>

Solution:

Good
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/5.5.2</title>
</head>
<body>

<table summary="This simple data table with caption.">
<caption>Caption</caption>
        <tr><td>1</td><td>2</td></tr>
        <tr><td>3</td><td>4</td></tr>

</table>
</body>
</html>

References: