中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Style textAlign 屬性

Style 對(duì)象參考手冊(cè) Style 對(duì)象

定義和用法

textAlign 屬性設(shè)置或返回塊級(jí)元素中文本的水平對(duì)齊方式。

語法

設(shè)置 textAlign 屬性:

Object.style.textAlign="left|right|center|justify|inherit"

返回 textAlign 屬性:

Object.style.textAlign
描述
left 默認(rèn)。把文本排列到左邊。
right 把文本排列到右邊。
center 把文本排列到中間。
justify 根據(jù) textJustify 屬性對(duì)齊文本。
inherit textAlign 屬性的值從父元素繼承。

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 textAlign 屬性。

注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有規(guī)定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。


實(shí)例

實(shí)例

居中對(duì)齊 p 元素中的文本:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<script>
function displayResult(){
????document.getElementById("p1").style.textAlign="center";
}
</script>
</head>
<body>

<p id="p1">這是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">對(duì)齊文本</button>

</body>
</html>

運(yùn)行代碼 ?

Style 對(duì)象參考手冊(cè) Style 對(duì)象其他擴(kuò)展