How to align tables in Microsoft FrontPage for cross-browser compatibility (324235)



The information in this article applies to:

  • Microsoft FrontPage 2002
  • Microsoft Office FrontPage 2003

This article was previously published under Q324235

SUMMARY

Microsoft FrontPage uses DIV tags in the HTML code that it generates to center tables on a Web page. While this method works with the Microsoft Internet Explorer Web browser, this method of formatting may not be supported by other Web browsers. This article contains methods that may be supported by Web browsers other than Microsoft Internet Explorer.

MORE INFORMATION

For better browser compatibility, Microsoft recommends that Web authors use one of the following methods.

Use the CENTER tag in HTML

To center a table by using the CENTER tag in HTML, the table must be placed inside a set of <CENTER></CENTER> tags--for example:
<CENTER>
<TABLE WIDTH="90%">
<TR>
<TD>One</TD>
<TD>Two</TD>
<TD>Three</TD>
</TR>
</TABLE>
</CENTER>

Use the ALIGN attribute of the TABLE tag in HTML

To center a table by using the ALIGN attribute of the TABLE tag in HTML, the opening tag for the table must have the ALIGN attribute added--for example:
<TABLE WIDTH="90%" ALIGN="CENTER">
<TR>
<TD>One</TD>
<TD>Two</TD>
<TD>Three</TD>
</TR>
</TABLE>

Use cascading style sheets

To create a centered table by using cascading style sheets, a table class must be used and both the left and the right margins must be equal. To do this, both the left and the right margins must be set to "auto"--for example:
<style>
table
{
   margin-left: auto;
   margin-right: auto;
}
</style>

This style will center all the tables on the page, when placed in the <head> section of the HTML page.

Note Microsoft Internet Explorer 6.0 accommodates two settings per page for strict and loose HTML compliance. By default all pages have loose settings. Therefore, this style will be ignored. To force Internet Explorer to follow strict HTML specifications and respect the table style, the following doctype declaration must be placed outside the <HTML> tags of the page:
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
For more information about HTML formatting, visit the following World Wide Web Consortium (W3C) Web site: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

Modification Type:MinorLast Reviewed:11/22/2005
Keywords:kbhowto KB324235