--- title: caption slug: Web/HTML/Elemento/caption tags: - HTML - 'HTML:Elemento' - Todas_las_Categorías translation_of: Web/HTML/Element/caption --- <h3 id="Definici.C3.B3n" name="Definici.C3.B3n">Definición</h3> <p>Es el encargado de darle un título descriptivo a las tablas.</p> <dl> <dd><strong>Sus etiquetas son</strong>: <code><caption></code> y <code></caption></code> (ambas obligatorias).</dd> </dl> <dl> <dd><strong>Crea una caja</strong>: .</dd> </dl> <dl> <dd><strong>Está definido como</strong>: Elemento <a href="es/HTML/Elemento/Tipos_de_elementos#para_tablas">para tablas</a>.</dd> </dl> <dl> <dd><strong>Puede contener</strong>: Texto y/o cero o más elementos <a href="es/HTML/Elemento/Tipos_de_elementos#en_l.C3.ADnea">en línea</a>.</dd> </dl> <h4 id="Atributos" name="Atributos">Atributos</h4> <table class="fullwidth-table standard-table"> <tbody> <tr> <th>atributo</th> <th>descripción</th> <th>valor</th> <th>por omisión</th> </tr> <tr> <th colspan="4">Genéricos</th> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/struct/global.html#adef-title"><span style="color: green;">title </span></a></td> <td>Texto informativo o título del elemento. Suele mostrarse a modo de "tool tip".</td> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/types.html#h-6.3">Texto legible</a>. Sensible a <abbr title="diferencia entre Mayúsculas y minúsculas">M/m.</abbr>.</td> <td>Lo fija el navegador.</td> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/struct/global.html#adef-id"><span style="color: green;">id </span></a></td> <td>Le da un nombre al elemento que lo diferencia de todos los demás del documento.</td> <td>Un <a class="external" href="http://html.conclase.net/w3c/html401-es/types.html#type-id">nombre único</a>. Sensible a <abbr title="diferencia entre Máyusculas y minúsculas">M/m.</abbr></td> <td>Lo fija el navegador.</td> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/struct/global.html#adef-class"><span style="color: green;">class </span></a></td> <td>Asigna nombres de clases al elemento. Por defecto, clases CSS.</td> <td>Lista de clases separadas por espacio en blanco. Sensible a <abbr title="diferencia entre Máyusculas y minúsculas">M/m.</abbr> <a class="external" href="http://html.conclase.net/w3c/html401-es/types.html#type-cdata">cdata</a></td> <td>Lo fija el navegador.</td> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/present/styles.html#adef-style"><span style="color: green;">style </span></a></td> <td>Permite especificar <a class="external" href="http://html.conclase.net/w3c/html401-es/present/styles.html">información de estilo</a>. Por defecto, estilos CSS.</td> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/types.html#type-style">Declaraciones de estilo</a>.</td> <td>Lo fija el navegador.</td> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/struct/dirlang.html#adef-lang"><span style="color: green;">lang </span></a></td> <td>Información sobre el <a class="external" href="http://html.conclase.net/w3c/html401-es/struct/dirlang.html">idioma del contenido</a> del elemento y del valor de sus atributos.</td> <td>Un <a class="external" href="http://html.conclase.net/w3c/html401-es/types.html#type-langcode">código de idioma</a>.</td> <td>Lo fija el navegador. <abbr title="Por defecto">PD.</abbr>: "desconocido".</td> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/struct/dirlang.html#adef-dir"><span style="color: green;">dir </span></a></td> <td>Indica la <a class="external" href="http://html.conclase.net/w3c/html401-es/struct/dirlang.html">dirección de texto</a> y tablas.</td> <td>Uno de los siguientes: <abbr title="Left-to-right"> 'ltr' </abbr> o <abbr title="Right-to-left"> 'rtl'. </abbr></td> <td>Lo fija el navegador. <abbr title="Por defecto">PD.</abbr>: En castellano 'ltr'.</td> </tr> <tr> <td colspan="4"><strong>Eventos</strong>: <code style="color: green;">onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup. </code></td> </tr> <tr> <th colspan="4">Específicos</th> </tr> <tr> <td colspan="4">No tiene</td> </tr> <tr> <th colspan="4">De transición</th> </tr> <tr> <td><a class="external" href="http://html.conclase.net/w3c/html401-es/struct/dirlang.html#adef-dir"><span style="color: green;">align </span></a></td> <td>Indica la alineación en relación a la tabla.</td> <td>Uno de los siguientes: 'top', 'bottom', 'left', 'right'.</td> <td>Lo fija el navegador.</td> </tr> <tr> <th>atributo</th> <th>descripción</th> <th>valor</th> <th>por omisión</th> </tr> </tbody> </table> <h3 id="Ejemplos_de_uso" name="Ejemplos_de_uso">Ejemplos de uso</h3> <div class="highlight"> <h4 id="Ejemplo_simple" name="Ejemplo_simple">Ejemplo simple</h4> <p>El siguiente código:</p> <pre class="eval"><span class="nowiki"> <table border='1'> <caption>Tabla con caption</caption> <tr> <td> tabla de una celda. </td> </tr> </table> </span> </pre> <p>Se visualiza así:</p> <div style="border: solid silver 1px;"> <table> <caption>Tabla con caption</caption> <tbody> <tr> <td>tabla de una celda.</td> </tr> </tbody> </table> </div> </div> <h3 id="Estilo_predeterminado" name="Estilo_predeterminado">Estilo predeterminado</h3> <h3 id="Notas" name="Notas">Notas</h3> <ul> <li>Debe ser el primer hijo del elemento table. una tabla solo puede tener uno.</li> </ul> <h3 id="Referencia" name="Referencia">Referencia</h3> <ul> <li>El elemento <a class="external" href="http://html.conclase.net/w3c/html401-es/struct/tables.html#h-11.2.2"><strong>caption</strong> en la especificación</a> de html 4.01</li> </ul> <p> </p> <h3 id="Soporte" name="Soporte">Soporte</h3> <p>Puede consultar esta <a class="external" href="http://www.webdevout.net/browser_support_html.php#support-html401-caption">comparativa</a>: IE6 vs IE7 vs FF1.5 vs OP9.</p> <hr> <div class="note"> <p>Estamos ampliando este documento, posiblemente contenga defectos y carencias. ¡Estamos en obras!... disculpen las molestias.</p> <p>¿Quieres participar en su elaboración? Para saber cómo hacerlo consulta <a>MDC:Como ayudar</a>.</p> </div> <p><br> <span class="comment">Categoría</span></p> <p><span class="comment">interwiki links</span></p> <p><span class="comment">automatismos</span></p>