HTML DOM textAlign Property
Complete Style Object Reference
Definition and Usage
The textAlign property aligns the text in an element.
Syntax
Object.style.textAlign=left|right|center|justify
|
Possible Values
| Value |
Description |
| left |
Aligns the text to the left |
| right |
Aligns the text to the right |
| center |
Centers the text |
| justify |
Aligns the text according to the textJustify property |
Example
The following example aligns a text:
<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>
|
Try-It-Yourself Demos
textAlign - Align a text
Complete Style Object Reference
Want To Be A Web Master?
If you want to be a Web Master, you will have to host your web site with an ISP (Internet Service Provider).
MaximumASP offers seven different configurations of dedicated servers to meet your Windows and .NET hosting needs.
Hosted on our multi-tiered Enterprise Class network, these servers provide the performance, security and reliability
you need to host your high end web sites and applications.
Visit MaximumASP
|