tr vAlignPropiedad
Objeto tr
Definición y uso
La propiedad vAlign establece o devuelve la alineación vertical de los datos en una fila.
Sintaxis
Establecer la propiedad vAlign:
trObject.vAlign="baseline|bottom|middle|top"
Devolver la propiedad vAlign:
trObject.vAlign
| Valor | Descripción |
|---|---|
| baseline | Alinear con la línea base. |
| bottom | Alinear el contenido abajo. |
| middle | Alinear el contenido abajo. |
| top | Alinear el contenido arriba. |
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales soportan la propiedad vAlign
Ejemplo
Ejemplo
El siguiente ejemplo cambia la alineación vertical de los datos en las celdas:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de Ejemplo (example.com)</title>
<script>
function displayResult(){
document.getElementById('tr2').vAlign="top";
}
</script>
</head>
<body>
<table width="50%" border="1">
<tr id="tr1">
<th>Primer nombre</th>
<th>Nombre siguiente</th>
<th>Texto</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
<td>Hola, mi nombre es Perter, necesito un texto largo para demostrar, necesito un texto largo para demostrar.</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Alinear contenido arriba</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de Ejemplo (example.com)</title>
<script>
function displayResult(){
document.getElementById('tr2').vAlign="top";
}
</script>
</head>
<body>
<table width="50%" border="1">
<tr id="tr1">
<th>Primer nombre</th>
<th>Nombre siguiente</th>
<th>Texto</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
<td>Hola, mi nombre es Perter, necesito un texto largo para demostrar, necesito un texto largo para demostrar.</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Alinear contenido arriba</button>
</body>
</html>
Pruébalo »
Objeto tr Otras extensiones