Tuesday, September 25, 2007

How to center your page contents

Have you ever wondered how the contents of all standard web sites stay in the middle of the screen regardless of the width of user's screen. One example of this feature can be found at http://www.msn.com/. You will notice if you change the width of the page there is always an equal amount of margin available in both sides of the page contents. As a result of this feature, the web site can support all different kinds of screen widths.

In order to achieve this functionality simply assign attribute align="center" to the main table of your page, the one that contains all other elements.

No comments: