Encabezados de filas y columnas bien hechos
Asocie cada celda con los encabezados correctos.
Encabezados de filas y columnas bien hechos es una lección gratuita de Web Accessibility Academy en CoddyKit. Esta es la lección 2 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Web Accessibility Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Web Accessibility Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
Most Tables Have Two Header Types
Real data usually has headers along the top and down the side. Each data cell sits at the crossing of a column header and a row header.
Every Cell Needs Both
The value 92 means little alone. Tie it to Ada and to Score and it becomes Ada, Score, 92. That pairing is the association you are building.
Column Headers Across the Top
The first row holds scope=col headers. As a user arrows down a column, the screen reader keeps announcing that column header for context.
<tr>
<th scope="col">Student</th>
<th scope="col">Score</th>
</tr>Row Headers Down the Side
The first cell in each body row becomes a scope=row header. It names the row so values get a who or a when as the user reads across.
<tr>
<th scope="row">Ada</th>
<td>92</td>
</tr>The Corner Cell
The top-left cell often sits above row headers and beside column headers. Leaving it as an empty th is fine and keeps the grid honest.
<tr><th></th><th scope="col">Score</th></tr>Default scope Is a Trap
Browsers try to guess scope, but the guess is unreliable for anything beyond the simplest grid. Always set scope yourself to be sure.
Use thead and tbody
Wrap header rows in thead and data rows in tbody. It clarifies structure for assistive tech and makes your markup far easier to read.
<thead>
<tr><th scope="col">Name</th></tr>
</thead>
<tbody>
<tr><th scope="row">Ada</th></tr>
</tbody>How a Screen Reader Reads It
Move to a data cell and the user hears the row header, the column header, then the value. Good scope is what makes that announcement accurate.
One Header Cell, One Job
Keep a th to a single role: a column header or a row header. Mixing data and labels in one cell muddies the association for everyone.
Test by Reading One Cell
Pick a random data cell and ask: do its headers fully explain it? If you cannot tell what a number means from its headers, your scope is wrong.
A Two-Axis Example
Column headers on top, row headers on the left, data in the middle. This matrix shape covers the vast majority of tables you will build.
<tr><th scope="row">Ada</th><td>92</td><td>88</td></tr>Quick Check
A user arrows onto a data cell deep inside a well-marked table.
Recap: Two Axes, Two Scopes
Column headers use scope=col, row headers use scope=row, and every data cell sits where they cross. Set scope yourself and never trust the guess.
Preguntas frecuentes
¿La lección «Encabezados de filas y columnas bien hechos» es gratis?
Sí — el texto completo de «Encabezados de filas y columnas bien hechos» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Web Accessibility Academy, actualiza a CoddyKit PRO. El curso de Web Accessibility Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Encabezados de filas y columnas bien hechos»?
Asocie cada celda con los encabezados correctos. Practicas Web Accessibility Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar Web Accessibility Academy?
No se requiere experiencia previa. Web Accessibility Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 2 de 4.
¿Cuánto tiempo toma la lección «Encabezados de filas y columnas bien hechos»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de Web Accessibility Academy?
Sí. Cada lección de Web Accessibility Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- th, scope y el elemento caption
- Encabezados de filas y columnas bien hechos
- Tablas complejas: asociación de headers e id
- Las tablas de maquetación son una trampa