In the realm of web development, the styling and presentation of content play a pivotal role in creating visually appealing and user-friendly interfaces. Cascading Style Sheets (CSS) stands as a powerful tool in the developer’s arsenal, offering a myriad of properties to control the appearance of HTML elements. Among these properties, `text-align` emerges as a fundamental attribute, wielding the ability to dictate the horizontal alignment of text within its container. As we embark on an exploration of CSS `text-align`, we delve into the nuances of this property, understanding how it shapes the visual hierarchy of content on the web and contributes to the seamless design of engaging and accessible websites.
Examples
/* text align to left */
p.left {
text-align: left;
}
/* text align in the center */
p.center {
text-align: center;
}
/* text align to the right */
p.right {
text-align: right;
}
/* justifies the text */
p.justified {
text-align: justified;
}