How to right align text in paragraph using CSS?

Answer

To right align text in paragraph using CSS, you can set the text-align style property for the paragraph elements with the value right.

CSS Code

The following is a typical CSS code to right align text in paragraph in HTML page using tag name p.

p {
   text-align: right;
}

Examples

We shall go through some working examples on how to right align text in paragraph using CSS. In the following examples, you may change the value of text-align and Run the code to visually observe the changes made to the Paragraph elements.

Example 1

You may edit the following code, and click on Run button.

Example 2

You may edit the following code, and click on Run button.