View Full Version : problem with div align=center

12-08-2006, 09:35 PM
i am having problems with the property align=center on apple computers(IE, safari..), on PC everything between the div tag shows itself centered but on Machintosh everything is justify on the left;
why is that??



<div align="center">
<table cellpadding="0" cellspacing="0" border="0" id="bio">


12-08-2006, 11:14 PM
If you want the div centered in the page, you need to give it a width, otherwise it'll stretch out to the entire page… or do you mean you want the text in the div centered?

12-08-2006, 11:20 PM
#1: Screw IE for Mac! Even Microsoft has stopped endorsement and support for that browser: http://www.microsoft.com/mac/products/internetexplorer/internetexplorer.aspx?pid=internetexplorer
#2: You shouldn't use the HTML properties anymore (as well as you shouldn't use tables to lay out your site). CSS does the job:

table#bio {
wisth: ???px;
margin: auto;

Rule of thumb:
Inline elements (like span, a, input, etc.) and text can be centered with text-align: center; applied to their parent element.
Block elements (like div, table, form, etc.) can be centered with margin: auto; (they also need a width because usually they will be 100% wide by default and you wouldn't notice the centering effect).