verticalAlign 屬性設(shè)置內(nèi)容在元素框中的垂直對(duì)齊方式。
Object.style.verticalAlign=value
值 | 描述 |
---|---|
baseline | 默認(rèn)。元素放置在父元素的基線上。 |
sub | 垂直對(duì)齊文本的下標(biāo)。 |
super | 垂直對(duì)齊文本的上標(biāo) |
top | 把元素的頂端與行中最高元素的頂端對(duì)齊 |
text-top | 把元素的頂端與父元素字體的頂端對(duì)齊 |
middle | 把此元素放置在父元素的中部。 |
bottom | 把元素的頂端與行中最低的元素的頂端對(duì)齊。 |
text-bottom | 把元素的底端與父元素字體的底端對(duì)齊。 |
length | |
% | 使用 "line-height" 屬性的百分比值來排列此元素。允許使用負(fù)值。 |
本例設(shè)置表格中文本的垂直對(duì)齊方式:
<html>
<head>
<script type="text/javascript">
function alignText()
{
document.getElementById("td1").style.verticalAlign="bottom";
}
</script>
</head>
<body>
<table border="1" height="100px">
<tr>
<td id="td1">
Some example text
</td>
</tr>
</table>
<br />
<input type="button" onclick="alignText()"
value="Align text" />
</body>
</html>
如對(duì)本文有疑問,請(qǐng)?zhí)峤坏浇涣髡搲瑥V大熱心網(wǎng)友會(huì)為你解答??! 點(diǎn)擊進(jìn)入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號(hào)