Latest web development tutorials

HTML DOM tr vAlign property

tr Object Reference tr objects

Definition and Usage

vAlign property sets or returns data in rows of vertical alignment.

grammar

Setting vAlign properties:

trObject.vAlign="baseline|bottom|middle|top"

Back vAlign properties:

trObject.vAlign

描述
baseline 与基线对齐。
bottom 对内容进行下对齐。
middle 对内容进行下对齐。
top 对内容进行上对齐。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support vAlign property


Examples

Examples

The following example changes the vertical arrangement of the cells within the data:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    document.getElementById('tr2').vAlign="top";
}
</script>
</head>
<body>

<table width="50%" border="1">
    <tr id="tr1">
        <th>第一个名称</th>
        <th>下一个名称</th>
        <th>文本</th>
    </tr>
    <tr id="tr2">
        <td>Peter</td>
        <td>Griffin</td>
        <td>你好,我的名字叫Perter,我需要一个长文本来演示,我需要一个长文本来演示。</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">内容向上对齐</button>

</body>
</html>

try it"


tr Object Reference tr objects