Skip to content

<caption> - Table Caption Element

Table Element

The <caption> element provides a title or description for its parent <table>. It helps users understand what the table represents before reading its contents. Captions are especially important for accessibility, as they give screen reader users immediate context about the table’s purpose.

Result
<table>
<caption>Table title or description</caption>
<!-- table rows and cells -->
</table>

The <caption> element must be the first child of the <table> element, appearing immediately after the opening <table> tag.

The <caption> element supports all global HTML attributes.

Result
Result
Result

You can position the caption above or below the table using the caption-side CSS property:

Result
Result
Result

Captions provide crucial context for assistive technology users:

  1. Screen readers announce the caption before reading table contents
  2. Users can decide if the table is relevant before exploring it
  3. Context is immediate - users don’t have to scan the entire table to understand its purpose
  4. Navigation is easier - screen readers can jump between tables using captions

Be Descriptive

Good: “Monthly Sales by Region - Q4 2024”

Bad: “Table 1”

Be Concise

Good: “Employee Contact Information”

Bad: “This table shows employee names, phone numbers, email addresses, and department assignments”

Front-Load Keywords

Good: “Pricing Comparison - Enterprise Plans”

Bad: “A comparison of our enterprise plan pricing”

Avoid Redundancy

Good: “Course Schedule - Fall 2024”

Bad: “Table of Course Schedule - Fall 2024”

Use for: Brief title visible to all users

<caption>Monthly Budget - March 2024</caption>
  • Always include a caption for every table
  • Place it first as the first child of <table>
  • Make it descriptive but concise
  • Use semantic HTML within the caption (like <strong>, <em>)
  • Style consistently across your site
  • Don’t use generic text like “Table 1” or “Data”
  • Don’t place it elsewhere - it must be the first child
  • Don’t hide it with CSS unless you provide an alternative
  • Don’t duplicate information already in headers
  • Don’t make it too long - keep it scannable
/* Basic caption styling */
caption {
caption-side: top; /* or bottom */
text-align: left; /* left, center, right */
font-size: 1.2em;
font-weight: bold;
padding: 10px;
color: #333;
}
/* Background and borders */
caption {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-bottom: none; /* if table has borders */
}
/* Styled caption */
caption {
background: linear-gradient(to right, #4facfe, #00f2fe);
color: white;
padding: 15px;
border-radius: 8px 8px 0 0;
}
<caption>
<span aria-hidden="true">📈</span>
Growth Metrics Dashboard
</caption>
<caption>
Sales Report
<time datetime="2024-01">January 2024</time>
</caption>
<caption>
<div class="caption-title">Product Inventory</div>
<div class="caption-subtitle">Last updated: <time>2024-03-15</time></div>
</caption>

The <caption> element is supported in all browsers:

  • ✅ Chrome (all versions)
  • ✅ Firefox (all versions)
  • ✅ Safari (all versions)
  • ✅ Edge (all versions)
  • ✅ Opera (all versions)
  • ✅ Internet Explorer (all versions)

The caption-side CSS property is supported in all modern browsers but has limited support in older versions of Internet Explorer.