CSS text-align Property

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP




<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->




CSS text-align Property



Previous
Complete CSS Reference
Next



Example


Set the text alignment for different <div> elements:



div.a
    text-align: center;



div.b
    text-align: left;



div.c
    text-align: right;


div.c
    text-align:
justify;

Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The text-align property specifies the horizontal alignment of text in an element.













Default value: left if direction is ltr, and right if direction is rtl
Inherited: yes
Animatable: no. Read about animatable
Version: CSS1
JavaScript syntax: object.style.textAlign="right"
Try it


Browser Support


The numbers in the table specify the first browser version that fully supports the property.















Property
text-align 1.0 3.0 1.0 1.0 3.5





<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->




CSS Syntax



text-align: left|right|center|justify|initial|inherit;


Property Values
























Value Description Play it
left Aligns the text to the left Play it »
right Aligns the text to the right Play it »
center Centers the text Play it »
justify Stretches the lines so that each line has equal width (like in newspapers and magazines) Play it »
initial Sets this property to its default value. Read about initial
Play it »
inherit Inherits this property from its parent element. Read about inherit


More Examples



Example


Another text-align example:



h1
    text-align: center;


p.date
    text-align: right;


p.main
    text-align: justify;

Try it Yourself »


Related Pages


CSS tutorial: CSS Text


HTML DOM reference: textAlign property




Previous
Complete CSS Reference
Next

Popular posts from this blog

WWE Night of Champions

Poznań

Kaliningrad