0% completed
Text alignment is used to determine how text is positioned within an element. By setting text alignment, you can choose whether the text appears to the left, right, center, or is justified within the element. This property helps improve the readability and overall layout of your content.
Controlling text alignment is essential for creating balanced designs that guide the reader's eye and improve the visual structure of your page.
Follow the code block below to set text alignment in CSS:
text-align: left | right | center | justify;
Explanation:
In this example, we align the text to the center for a heading and a paragraph. This creates a balanced appearance for elements that should stand out.
Explanation:
.center-text class uses text-align: center to center the text.In this example, we use text-align: justify to align the text evenly on both sides. This is often used in articles and reports to create a neat block of text.
Explanation:
.justify-text class applies text-align: justify to the paragraph.This lesson illustrates how to use the text-align property to control the horizontal alignment of text. By centering or justifying text, you can create layouts that improve the readability and aesthetic balance of your content.
.....
.....
.....