HTML Text Alignment

HTML Text Alignment

HTML Text Alignment

HTML Text alignment is used to align the text on the web page (like left, right, center etc.).

  • HTML Text Alignment is defined by style="text-align:value;" syntax.

  • Value can be (left, right or center).

  • "By default, the text is aligned on the left side of the web page."

  • It can be used with any HTML element inside Opening tag.


Example:
<p style="text-align:center;">This text align on the center of the web page.</p>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Center Text Alignment.

  • Center attribute align the text on the center of the Web page.

  • It helps to align the heading on the center which gives the better look of heading on Web Page.

Run the code to see the effect.

Example:
<p style="text-align:right;">This text align on the right side of the web page.</p>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Center Text Alignment.

  • Right attribute aligns the text on the right of the Web page.

  • It is a very rare attribute which is used in HTML language.

Run the code to see the effect.




HTML Text Alignment in Hindi

Best Use:360p or more (480p or 720p)
×

Course Menu