How to align text in HTML?

Use CSS style with the “text-align” property. There are three values for “text-align” property, there are left, right, and center.

Here are examples:

.center-align {
text-align: center;
.left-align {
text-align: left;
.right-align {
text-align: right;

<p class="center-align">Center-aligned text</p>
<p class="left-align">Left-aligned text</p>
<p class="right-align">Right-aligned text</p>

Go from files to website in seconds.

Start a free trial for 7 days — no credit card required

Get Started for Free