HTML DOM td/th vAlign Property

## JavaScript Reference

Overview

## JavaScript Objects

JS Array JS Boolean JS Date JS Math JS Number JS String JS RegExp JS Global

## Browser Objects

Window Navigator Screen History Location

## HTML DOM Objects

DOM Document DOM Elements DOM Attributes DOM Events

## HTML Objects

DOM Anchor DOM Area DOM Base DOM Body DOM Button DOM Form DOM Frame/IFrame DOM Frameset DOM Image DOM Input Button DOM Input Checkbox DOM Input File DOM Input Hidden DOM Input Password DOM Input Radio DOM Input Reset DOM Input Submit DOM Input Text DOM Link DOM Meta DOM Object DOM Option DOM Select DOM Style DOM Table DOM td / th DOM tr DOM Textarea

# td/th vAlign Property

td/th Object

## Definition and Usage

The vAlign property sets or returns the vertical alignment of the content within a cell.

## Syntax

Set the vAlign property:

tdObject.vAlign="baseline|bottom|middle|top"
or
thObject.vAlign="baseline|bottom|middle|top"

Return the vAlign property:

tdObject.vAlign
or
thObject.vAlign

Value | Description
--- | ---
baseline | Content is aligned to the baseline. The baseline is the "imaginary line" which most letters "sit" on, in a line of text. The baseline value sets the row so that all the table data share the same baseline. Often this has the same effect as the bottom value. However, if the fonts are in different sizes, baseline looks better.
bottom | Content is aligned to the bottom
middle | Content is aligned to the middle. This is default
top | Content is aligned to the top

## Browser Support

The vAlign property is supported in all major browsers.

## Example

Change the vertical alignment of the content within the table cells:

<html>
<head>
<script>
function displayResult()
{
document.getElementById('td1').vAlign="top";
document.getElementById('td2').vAlign="top";
document.getElementById('td3').vAlign="top";
}
</script>
</head>
<body>
<table width="50%" border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Text</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
<td id="td3">Hello my name is Peter Griffin.
I need a long text for this example.
I need a long text for this example.</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Top-align content</button>
</body>
</html>
Try it yourself »

td/th Object

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE