| Inherited | Initial | Version |
|---|---|---|
| Yes | CSS1, 2 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ |
|---|---|---|---|
| Buggy | Full | Full | Full |
Syntax
Description
This property specifies how the inline content of a block is aligned, when the sum of the widths of the inline boxes is less than the width of the line box.
Example
This style rule makes text in
h1 headings centered:
h1 {
text-align: center;
}
Value
The initial value is
left if direction is
ltr, and right if
direction is rtl.
center- This value makes the text center justified.
justify- This value makes the text left and right justified. In this
case, inline boxes may be stretched in addition to being
repositioned. If
white-spaceispreorpre-line, the alignment is set to the initial value. left- This value makes the text left justified.
right- This value makes the text right justified.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.0 | 1.5 | 2.0 | 1.3 | 2.0 | 3.0 | 9.2 | 9.5 |
| Buggy | Buggy | Buggy | Full | Full | Full | Full | Full | Full | Full | Full |
Internet Explorer for
Windows versions up to and including 7 incorrectly align block-level boxes
according to the text-align property, although it
should only affect inline boxes. The value justify
behaves like center for table caption boxes.
Internet Explorer for Windows versions up to and
including 7 don’t support the value inherit.
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.