html tutorial - align Attribute in HTML - html5 - html code - html form



align attribute in html

Learn html - html tutorial - align attribute in html - html examples - html programs

  • The align attribute is used to align the text of the element.
  • The align attribute can be declare to any visible element.

Syntax for align attribute:

<element align=”value”>

Differences between HTML 4.01 and HTML5 for align attribute:

HTML 4.01

  • HTML4 support align attribute.

HTML5

  • HTML5 does not support align attribute.

align Attribute Value:

Value Description
start Elements are aligned starting from the left or top edge of the box.
center Elements are being placed in the center of the box.
end Elements are placed on the right or bottom edge of the box
baseline Value applies to horizontally so that the elements to be aligned in text and the labels are lined up.
stretch Stretched to fit the size of the box.
left Aligned in left edges.
center Aligned in Centered position
right Aligned in right edges.

Sample coding for align attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy align attribute</title>
    </head>
    <body>
        <p align="right">Wikitechy Right Alignment.</p>
        <p align="left">Wikitechy Left Alignment.</p>
        <p align="center">Wikitechy Center Alignment.</p>
    </body>
</html>

Code Explanation for align attribute :

align Attribute Code Explanation

  1. The align attribute used to set alignment of the content.
  2. “right” value of align attribute is used to align the content in the right.

Output for <align> attribute in HTML:

align Attribute Output

  1. The text “Wikitechy Right Alignment” is displayed in right side of the HTML document.
  2. The text “Wikitechy Left Alignment” is displayed in left side of the HTML document.
  3. The text “Wikitechy Center Alignment” is displayed in center of the HTML document.

Browser Support for align attribute in HTML:

Yes Yes Yes Yes Yes

Tips and Notes

  • align attribute has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped.

Related Searches to align Attribute in html