A slightly more flexible method of aligning text elements is to use the <div>(division)tag. <div> includes several attributes, which are listed in appendix B. among these attributes is a align (deprecated in HTML 4.01), which align elements to the left, right, or center just as it does for headings and paragraphs. Unlike using alignments in individually mends, however, <div> is used surround a block of HTML tags of any kind, and it affects all the tags and text inside the opening and closing tags. Two advantage of div over the align attribute follows.
You need to use <div> only once, rather than including align repeatedly in several different tags.
Ø <div> can be used to align anything (headings, <h2 align =”left”> <a href=”who.html”>who we are</a></h2> paragraphs, quotes, images, tables, and so on); the align attribute is available on only alimited number of tags.
To align a block of HTML code, surround it with opening and closing <div> tags, and then include the align attribute in the opening tag, as in other tags, align can have the value left, right, or center:
<h1 align=”left”> serendipity products </h1>
<div align =”right”>
<h2><a href=”who. Html”>who we are</a></h2>
<h2><a href=”products.html”> what we do</a></h2>
<h2><a href=”contacts.html”> how to reach us </a></h2>
</div>
All the HTML between the two <div> tags will be aligned according to the value of the align attribute. If individual align attributes appear in headings or paragraphs inside the <div>, those values will override the global <div> setting.