Copyright © tutorialspoint.com

CSS - text-align

previous next


Advertisements

Description:

The text-align property determines the way in which line boxes are aligned within a block-level element.

Possible Values:

Applies to:

All the block-level elements (except the value <string>, which applies only to table cells)

DOM Syntax:

object.style.textAlign="justify";

Example:

Following is the example which demonstrates how to align a text:

<p style="text-align:right;">
This will be right aligned.
</p>
<p style="text-align:center;">
This will be center aligned.
</p>
<p style="text-align:left;">
This will be left aligned.
</p>

This will produce following result:

This will be right aligned.

This will be center aligned.

This will be left aligned.

To Become more comfortable - Do Online Practice


previous next

Copyright © tutorialspoint.com