text-align | css text align
Thetext-alignpropertyinCSSisusedforaligningtheinnercontentofablockelement.p{ text-align:center; }Thesearethetraditionalvaluesfortext-align:left–Thedefaultvalue.Contentalignsalongtheleftside.right–Contentalignsalongtherightside.center–Contentcentersbetweentheleftandrightedges.Whitespaceontheleftandrightsidesofeachlineshouldbeequal.justify–Contentspacesoutsuchthatasmanyblocksfitontoonelineaspossibleandthefirstwordonthatlineisalongtheleftedgeandthelastwordisalongtherightedge.inherit–The...
The text-align property in CSS is used for aligning the inner content of a block element.
p { text-align: center; }These are the traditional values for text-align:
left – The default value. Content aligns along the left side. right – Content aligns along the right side. center – Content centers between the left and right edges. White space on the left and right sides of each line should be equal. justify – Content spaces out such that as many blocks fit onto one line as possible and the first word on that line is along the left edge and the last word is along the right edge. inherit – The value will be whatever the parent element’s is.“Content” is used here as as term instead of “text”, because while text-align certainly affects text, it affects all inline or inline-block elements in that container.
There are two new values in CSS3 as well, start and end. These values make multiple language support easier For example, English is a left-...