English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
text-The CSS 'align' property sets the horizontal alignment of inline content (such as text and images) within its parent block element (such as a heading or paragraph).
下表为此属性的用法说明和版本历史记录,以及该属性在javascript脚本中的使用语法。
The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts. | Default Value:left ifdirection39; is #39; ltr#39; right if direction is #39; rtl# |
---|---|
; | Applicable To: |
Block-level elements, table cells, and inline blocks | Inheritance: |
Yes | Animatable:No. 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 to see‹/›
The following table describes the values 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.-align Attribute Values. |
text-Browser Compatibility of align Attribute, the numbers in the table below represent the minimum version number of the browser that supports 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.