To right align heading using CSS, you can set the text-align
style property for the heading 2 elements with the value right
.
The following is a typical CSS code to right align heading in HTML page using tag name h2
.
h2 {
text-align: right;
}
We shall go through some working examples on how to right align heading 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 Heading 2 elements.
You may edit the following code, and click on Run button.
You may edit the following code, and click on Run button.