English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Manual de referencia HTML

Comprehensive lista de etiquetas HTML

Atributo align de caption en HTML

El atributo align define el alineamiento del elemento de subtítulo. Este atributo debe alinear el título como un elemento de bloque a la izquierda, derecha, arriba o abajo de la tabla.

HTML <caption> etiqueta

Ejemplo en línea

Tabla con elementos <caption> alineados a izquierda, derecha, abajo y arriba:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">-8">
<título>Uso del atributo align de <caption> en HTML</título>-Tutoriales básicos(oldtoolbag.com)</título>/título>
<style>
tabla, th, td {
  borde: 1px sólido negro;
}
</style>
</head>
<body>
<p>align="left":</p>
<table>
  <caption align="left">My savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="right":</p>
<table>
  <caption align="right">My savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="top":</p>
<table>
  <caption align="top">My savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
<p>align="bottom":</p>
<table>
  <caption align="bottom">My savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
</body>
</html>
测试看看 ‹/›

浏览器兼容性

IEFirefoxOperaChromeSafari

所有主流浏览器都支持 align 属性。

注意:

  • Internet Explorer 8 支持 "left", "right", "top", 和 "bottom" 值。

  • Internet Explorer 9+ 支持 "top", 和 "bottom" 值。

  • Firefox 支持 "left", "right", "top", 和 "bottom" 值。

  • Opera 支持 "left", "right", "top", 和 "bottom" 值。

  • Chrome 支持"top", 和 "bottom" 值。

  • Safari 支持 "top", 和 "bottom" 值。

定义和用法

HTML5 No se admite la propiedad <caption> alineación. Utilice CSS en su lugar.

La propiedad alineación de <caption> en HTML 4.01 Se ha obsolecido.

La propiedad alineación especifica el modo de alineación del elemento caption.

Esta propiedad alinea el caption como un elemento de bloque a la izquierda, derecha, arriba o abajo de la tabla.

Comentarios de compatibilidad

THTML5 No se admite la propiedad <caption> alineación. Utilice CSS en su lugar.

Sintaxis de CSS: <caption estilo="caption-lateral:abajo"> o <caption estilo="text-alineación:left">

Ejemplo de CSS: Alineación del título de la tabla

En nuestra guía de CSS, puede encontrar más información sobrecaption-lateral Detalles del atributo.

Sintaxis

<caption alineación="izquierda|derecha|arriba|abajo">

Valor de atributo

ValorDescripción
izquierdaEl título está a la izquierda de la tabla.
derechaEl título está a la derecha de la tabla.
arribaEl título está encima de la tabla.
abajoEl título está debajo de la tabla.

HTML <caption> etiqueta