HTML CSS Reference/CSS Attributes and Javascript Style Properties/text align

Материал из Web эксперт
Перейти к: навигация, поиск

"text-align" Example

   <source lang="html4strict">
   

<html> <body>

    Sample text, aligned center.

<button onclick="myDiv.style.textAlign="right";">Align Right</button> </body> </html>


     </source>
   
  


"text-align" is applied to

   <source lang="html4strict">

+----------------+--------------------------------------------------------------+

| Applied_To |
<body> | | |
currentStyle |

| |

<dir> |

| |
|

| |

<fieldset> | | |<form> <hn> |

| |
<input type="password"> | | |<input type="text">
  • | | |<listing> <marquee> | | |<menu>
      | | |

                               |
      |                |runtimeStyle                    style                         |
      |                |
        | | |<xmp> | +----------------+--------------------------------------------------------------+ </source>

        "text-align" Possible Values

        <source lang="html4strict"> Possible Values left (the default), right, center, justify.


        </source>



        "text-align" Syntax and Note

        <source lang="html4strict"> Note: The horizontal text alignment.

        Syntax:

        element { text-align: value } elementID.style.textAlign = "value" document.all.elementID.style.textAlign = "value" // IE only


        </source>
      | | |<textarea> | | |