Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB324235, kbhowto

↑ Back to the top

Article Info
Article ID : 324235
Revision : 4
Created on : 2/1/2007
Published on : 2/1/2007
Exists online : False
Views : 370