Replacement for align="center" Tag Property

The HTML tag property  align="center" is being depreciated, a fancy way of saying no longer supported. This can be a problem if you want to align a table in the center of the screen or use older software to write web pages. It is recommended to use style sheets but a simple way is to manually type the inline code styles, see the example below. If have found that this method works with Mozilla Firefox, IE6, IE7, and IE8.

Old Way:
<table align="center"> 
</table>
 
Inline Code Style:
<table style="margin-right: auto; margin-left: auto;> 
</table>
 
Using Styles:
<style>
.tablecenter {
margin-right: auto;
margin-left: auto;
}
</style>

The style declaration should be placed in the head section of the page or in the style sheet you are using for the website. The ".tablecenter" defines the style as a class that can be used on multiple tables. To use this style just define the table in the body of your html as below.

<table class="tablecenter">
</table>

 

Sitemap | Privacy Statement

Copyright ©1993-2024 McGrath Electronics, Inc.  All Rights Reserved