/

HTML / CSS / JavaScript Tutorial

CSS Property: text-align

[this page | pdf | back links]

The CSS (CSS1) text-align property indicates how text in an element should be aligned.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

center

Centres the text

justify

Justifies text, i.e. stretches lines to encompass whole width. The precise way justification then works is set by the text-justify property.

left

Aligns text to left

right

Aligns text to right

 

Default Value:

left if direction is ltr (left-to-right), right if direction is rtl (right-to-left)

JavaScript syntax:

e.g. object.style.textAlign="justify"

Inherited:

Yes

Animatable:

No

 


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile