text-align

The text-align CSS property describes how the inline-level content of a block is aligned along the inline axis if the content does not completely fill the line box.

Syntax

CSS

text-align: value;

JS

object.style.textAlign = "value";

Values

<'text-align'> = start | end | left | right | center | justify | match-parent | justify-all
start

Inline-level content is aligned to the start edge of the line box.

end

Inline-level content is aligned to the end edge of the line box.

left

Inline-level content is aligned to the line left edge of the line box.

right

Inline-level content is aligned to the line right edge of the line box.

center

Inline-level content is centered within the line box.

justify

Text is justified according to the method specified by the text-justify property, in order to exactly fill the line box.

match-parent

Behaves the same as inherit except that an inherited value of start or end is interpreted against the parent's direction value and results in a computed value of either left or right.

justify-all

Sets both text-align-all and text-align-last to justify, forcing the last line to justify as well.

Initial

start

Examples

start

end

left

right

center

justify

match-parent

justify-all

JS

Internal

text-align-last

text-justify

External

World Wide Web Consortium (W3C)

Home Menu