The text-align property in CSS is used to set the horizontal alignment of text within an element. It works for block-level elements such as <p>, <div>, <h1>, etc. Here are the common values for text-align:
- left: Aligns the text to the left. This is the default setting.
- right: Aligns the text to the right.
- center: Centers the text horizontally within its container.
- justify: Stretches the text so that each line has equal width, aligning both left and right edges.
HTML Example: