javascript textAlign property


  Translation results:

text

English[tekst] American[tɛkst]

n. Text, original text; text, textbook; theme; version

v .Texting

Third person singular: texts Plural: texts Present participle: texting Past tense: texted

align

英[əˈlaɪn] 美[ əˈlaɪn]

vt. To form a line, to form an alliance; to line up in order

vi. To arrange; to form a line

Third person singular: aligns Present participle: aligning Past tense: aligned past participle: aligned

javascript textAlign propertysyntax

Function: Align the text in the element.

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

javascript textAlign propertyexample

<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>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A