Align Text

How to: Align Text

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email

By adding what ever class or id you used to identify the text you wish to align (i will be using h1, h2, and h3 as an example) you will be able to align your text to the right, centered, or to the left.

Adding this code to the <style>


h1 {
text-align: center;

h2 {
text-align: left;

h3 {
text-align: right;


And adding this text to the <body>


<h1>Heading 1 (center)</h1>
<h2>Heading 2 (left)</h2>
<h3>Heading 3 (right)</h3>


The h1 will be aligned to the center, the h2 will be aligned to the left and the h3 will be aligned to the right.