Text Alignment

The text-align property is used to to control the alignment of a block of text.

The values of text-align are.

ValuesDescription
left | right | center | justify
<string>It is used for vertical alignment. Applies for table cells.
inheritinherited from parent

Notes
Browser do not yet support the <string> alignment.


snippet
<html>
<head>
<style>
p {text-align:justify;}
div {text-align:right}
td {text-align:"."}
</style>
</head>
<body>
<p>This is a paragraph text</p>
<div>This is a text inside div</div>
<table>
<tr><th>Lorem Ipsum</th></tr>
<tr><td>optio neque cum aperiam adipisci minus atque corrupti</td></tr>
<tr><td>illo obcaecati dolore id perspiciatis</td></tr>
<tr><td>illum iusto perferendis ipsam harum ab libero</td></tr>
</table>
</body>
</html>

Output

This is a paragraph text

This is a text inside div
Lorem Ipsum
optio neque cum aperiam adipisci minus atque corrupti
illo obcaecati dolore id perspiciatis
illum iusto perferendis ipsam harum ab libero
Related Tutorial
1. Text