English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
text-L'attribut CSS aligne la contenu en ligne (comme du texte et des images) dans l'élément de bloc parent (comme un titre ou un paragraphe) de manière horizontale.
The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.
Default value: | left ifdirectionis #39; ltr#39; right if direction is #39; rtl#39; |
---|---|
Applies to: | Block-level elements, table cells, and inline blocks |
Inheritance: | Yes |
Can be animated: | No.Please see Animation attribute. |
Version: | CSS 1,2,3 |
JavaScript syntax: | object.style.textAlign="right" |
The syntax of this attribute is as follows:
text-align: left | right | center | justify | initial | inherit
The following example demonstrates how to use text-align attribute.
h1 { text-align: center; } p { text-align: justify; }Test see‹/›
The following table describes the value of this attribute.
Value | Description |
---|---|
left | Align inline text to the left. |
right | Align inline text to the right. |
center | Center inline text. |
justify | Text makes sense. Text aligns its left and right edges to the left and right content edges of the paragraph by stretching spaces and words. |
initial | Set this attribute to its default value. |
inherit | If specified, the associated elements adopt the text of their parent element-The value of align attribute. |
text-The compatibility of align attribute in browsers, the numbers in the following table represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.
|
Please refer to the following tutorials:CSS text,CSS alignment.
Text-related attributes:letter-spacing,text-decoration,text-indent,text-overflow,text-shadow,text-transform,white-space,word-spacing.