Text Align
The CSS text-align property can be used to format the text in a web page, the text can be aligned to the left or right, centered or justified.
Text Align properties are:
- text-align: center;
- text-align: right;
- text-align: left;
- text-align: justify;
Text Align example:
<html> <head> <style> h1 {text-align: center;} h2 {text-align: left;} h3 {text-align: right;} p {text-align: justify;} </style> </head> <body> <h1>CSS text-align property</h1> <h2>Align left</h2> <h3>Align right</h3> <p>The CSS text-align property can be used to justify web page text. This text is an example showing how to use the CSS text-align property.</p> </body> </html>
Text Align result:
<html> <head> <style> h1 {text-align: center;} h2 {text-align: left;} h3 {text-align: right;} p {text-align: justify;} </style> </head> <body> <h1>CSS text-align property</h1> <h2>Align left</h2> <h3>Align right</h3> <p>The CSS text-align property can be used to justify web page text. This text is an example showing how to use the CSS text-align property.</p> </body> </html>