Home | Computer Science

<
CSS Text Allignment

Defination

The text-align property is used to set the horizontal alignment of a text. A text can be left or right aligned, centered,or justified.


CSS Text Align Syntax of Text Align is
p {
Text-align: ;
}
There are three types of Text align
1.Right 2.Left 3.Center 4.Justify
Program
INPUT

<html> <head> <style> h1 { text-align: center; } h2 { text-align: left; } h3 { text-align: right; } h4 { text-align: justify; } </style> </head> <body> <h1>Heading 1 (center)</h1> <h2>Heading 2 (left)</h2> <h3>Heading 3 (right)</h3> <h4>Heading 4(justify)</h4> </body> </html>

OUTPUT