HTML CSS Reference/CSS Attributes and Javascript Style Properties/text align
Содержание
"text-align" Example
<html>
<body>
<div id="myDiv"
style="text-align:center">
Sample text, aligned center.
</div>
<button onclick="myDiv.style.textAlign="right";">Align Right</button>
</body>
</html>
"text-align" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<blockquote> <body> |
| |<center> currentStyle |
| |<dd> <dir> |
| |<div> <dl> |
| |<dt> <fieldset> |
| |<form> <hn> |
| |<hr> <input type="password"> |
| |<input type="text"> <li> |
| |<listing> <marquee> |
| |<menu> <ol> |
| |<p> <pre> |
| |runtimeStyle style |
| |<table> <td> |
| |<textarea> <th> |
| |<tr> <ul> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"text-align" Possible Values
Possible Values
left (the default),
right,
center,
justify.
"text-align" Syntax and Note
Note:
The horizontal text alignment.
Syntax:
element { text-align: value }
elementID.style.textAlign = "value"
document.all.elementID.style.textAlign = "value" // IE only