HTML-DOM tr vAlign Eigenschaft
Definition und Verwendung
vAlign Eigenschaftssätze oder gibt Daten in Reihen vertikaler Ausrichtung.
Grammatik
Einstellen vAlign Eigenschaften:
trObject.vAlign="baseline|bottom|middle|top"
Zurück vAlign Eigenschaften:
trObject.vAlign
值 | 描述 |
---|---|
baseline | 与基线对齐。 |
bottom | 对内容进行下对齐。 |
middle | 对内容进行下对齐。 |
top | 对内容进行上对齐。 |
Browser-Unterstützung
Alle gängigen Browser unterstützen vAlign Eigentum
Beispiele
Beispiele
Im folgenden Beispiel wird die vertikale Anordnung der Zellen innerhalb der Daten:
<!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>
<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>
Versuchen »
tr Objekte