HTML DOM textAlign ÊôÐÔ

HTML DOM Style ¶ÔÏó

¶¨ÒåºÍÓ÷¨

textAlign ÊôÐÔ¶ÔÆëÔªËØÖеÄÎı¾¡£

Óï·¨£º

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

¿ÉÄܵÄÖµ

Öµ ÃèÊö
left °ÑÎı¾ÅÅÁе½×ó±ß¡£Ä¬ÈÏÖµ£ºÓÉä¯ÀÀÆ÷¾ö¶¨¡£
right °ÑÎı¾ÅÅÁе½Óұߡ£
center °ÑÎı¾ÅÅÁе½Öм䡣
justify ¸ù¾Ý textJustify ÊôÐÔ¶ÔÆëÎı¾¡£

ʵÀý

±¾Àý¶ÔÆëÒ»¶ÎÎı¾£º

<html>
<head>
<script type="text/javascript">
function setTextAlign()
{
document.getElementById("p1").style.textAlign="right";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setTextAlign()"
value="Align text" />

</body>
</html>

HTML DOM Style ¶ÔÏó

VUE