0Pricing
Web Accessibility Academy · Leçon

th, scope et l'élément caption

Donnez un titre au tableau et utilisez des cellules d'en-tête appropriées.

th, scope et l'élément caption est une leçon Web Accessibility Academy gratuite sur CoddyKit. Ceci est la leçon 1 sur 4. Tu peux lire la leçon complète ci-dessous gratuitement — puis la pratiquer en direct dans le navigateur avec un éditeur de code intégré et un tuteur IA 24/7. Elle fait partie du parcours d'apprentissage Web Accessibility Academy, et ta progression se synchronise sur le web et l'application CoddyKit. Le cours Web Accessibility Academy comprend 4 leçons au total.

Certaines parties de cette leçon n'ont pas encore été traduites et s'affichent en anglais.

Data Tables Carry Meaning

A real data table shows relationships between rows and columns. Mark it up well and screen readers can announce which header each value belongs to.

A Plain Table Is Confusing

If every cell is just a td, a screen reader reads numbers with no context. The user hears values but never learns what they mean.

<table>
  <tr><td>Name</td><td>Score</td></tr>
  <tr><td>Ada</td><td>92</td></tr>
</table>

Header Cells Use th

Swap header cells from td to th. Now the browser knows those cells label the data, not hold it, and exposes them as headers.

<tr><th>Name</th><th>Score</th></tr>

Why th Changes Everything

A th element is announced as a header and can be tied to the cells it describes. That link is what gives lonely numbers their meaning.

The scope Attribute

Add scope to each th to say which cells it covers. The value is col for a column header or row for a row header.

<th scope="col">Score</th>

scope=col for Top Headers

Use scope=col on the header at the top of a column. Every cell below it inherits that label as the user moves down.

<th scope="col">City</th>

scope=row for Side Headers

Use scope=row on the first cell of a row when it names that row, like a person or a date along the left edge.

<th scope="row">Ada</th>

caption Names the Table

The caption element gives the whole table a title. Screen reader users hear it first, so they know what they are about to explore.

<table>
  <caption>Quiz scores by student</caption>
</table>

caption Must Come First

Place caption as the very first child inside the table, right after the opening tag. Any other position is invalid and may be ignored.

Caption Beats a Heading

A nearby h2 is not enough. The caption is programmatically tied to the table, so users discover the title even when jumping table to table.

A Complete Simple Table

Caption, header row of th with scope, then data rows. This foundation makes most simple tables fully accessible with zero ARIA.

<table>
  <caption>Scores</caption>
  <tr><th scope="col">Name</th><th scope="col">Score</th></tr>
  <tr><th scope="row">Ada</th><td>92</td></tr>
</table>

Quick Check

You are labeling the column header at the top of a table.

Recap: The Three Building Blocks

You learned the trio of accessible tables: th for headers, scope to aim them, and caption to name the table. That is most of the job done.

Questions Fréquemment Posées

La leçon « th, scope et l'élément caption » est-elle gratuite ?

Oui — le texte complet de « th, scope et l'élément caption » est gratuit à lire ici sur le web. Pour la pratiquer de manière interactive (un éditeur de code intégré et un tuteur IA 24/7) et déverrouiller le reste du cours Web Accessibility Academy, passe à CoddyKit PRO. Le cours Web Accessibility Academy comprend 4 leçons au total.

Qu'est-ce que j'apprendrai dans « th, scope et l'élément caption » ?

Donnez un titre au tableau et utilisez des cellules d'en-tête appropriées. Tu pratiques Web Accessibility Academy avec du code pratique que tu exécutes directement dans le navigateur, et un tuteur IA 24/7 répond à tes questions au fur et à mesure que tu avances dans la leçon.

Dois-je avoir de l'expérience pour commencer Web Accessibility Academy ?

Aucune expérience préalable n'est requise. Web Accessibility Academy sur CoddyKit est structuré pour les débutants jusqu'aux apprenants avancés, donc tu peux commencer ici ou depuis le début et avancer à ton rythme. Ceci est la leçon 1 sur 4.

Combien de temps prend la leçon « th, scope et l'élément caption » ?

La plupart des leçons CoddyKit prennent environ 5–10 minutes. Chacune est courte et interactive, tu progresses régulièrement et tu repiques exactement où tu t'es arrêté sur le web et l'app.

Peux-tu écrire et exécuter du code dans cette leçon Web Accessibility Academy ?

Oui. Chaque leçon Web Accessibility Academy inclut un éditeur de code intégré, tu écris et exécutes du vrai code directement dans ton navigateur et tu reçois des retours IA instantanés — aucune configuration locale requise.

Toutes les leçons de ce cours

  1. th, scope et l'élément caption
  2. En-têtes de lignes et de colonnes bien définis
  3. Tableaux complexes : associer headers et id
  4. Les tableaux de mise en page sont un piège
← Retour à Web Accessibility Academy