HTML <td> widthAtributo
Ejemplos
Dos celdas de tabla con ancho predefinido:
<table border="1"
width="100%">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td width="70%">January</td>
<td width="30%">$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td width="70%">January</td>
<td width="30%">$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
Pruébalo tú mismo »
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten el atributo width.
Definición y uso
HTML5 no admite el atributo width de <td>. Utilice CSS en su lugar.
En HTML 4.01, el atributo width de <td>está en desuso。
El atributo width especifica el ancho de la celda de la tabla.
Normalmente, una celda ocupa el espacio que necesita para mostrar su contenido. El atributo width se utiliza para establecer un ancho predefinido para la celda.
Notas de compatibilidad
En HTML 4.01, el atributo width de <td> está en desuso. Utilice CSS en su lugar.
Sintaxis CSS: <td style="width:100px">
En nuestro tutorial de CSS, puede encontrar más detalles sobreel atributo width.
Sintaxis
<td width="pixels|%">
Valores de atributo
| Valor | Descripción |
|---|---|
| pixels | Establece el ancho en píxeles (por ejemplo, width="50"). |
| percent | Establece el ancho como porcentaje del elemento contenedor (por ejemplo, width="50%"). |
Etiqueta HTML <td> Otras extensiones