Centering a table with CSS in Mozilla ( 7 Views )
-
So I don't want to use the deprecated <center></center> tags.
What I did is made a .centercontainer which basicly just contains: text-align: center;
Then I wrapped the <div class="centecontainer"> around my table which I use to format a form properly(It's just easier with tables in that case).
It works in IE6 but not Mozilla. Please advise!
Thanks,
Trevor
(tahsin, Iceland)
use:
Code:
.centercontainer
{
margin-left:auto;
margin right:auto
}
(Ali, United Arab Emirates)
That doesn't work.
(tubili, Azerbaijan)
(hüseyin, Afghanistan)
Nevermind, I got it to work.
You were right, I just took off completly removed my .centercontainer and added
Code:
table {
margin-left: auto;
margin-right: auto;
}
Tks
(ömür, Iran, Islamic Republic of)
The best way to do it, is keep the container, for IE5 compatibility, and add margins to the table:
Code:
.center {
text-align:center;
}
.center table {
margin-left:auto;
margin-right:auto;
}
.center table td {
text-align:left;
}
Hope that helps [img]images/smilies/smile.gif[/img]
Usage:
HTML Code:
<div class="center">
This is centered text<br />
<table cellspacing="0" cellpadding="3">
<tr>
<th>Hello</th>
</tr>
</table>
</div>
(eren , Portugal)
Thanks! I have yet to test my site with IE5. I'm sure it's not pretty. So far I've focused on compatibility with Opera 7, Mozilla & IE6
(mehman, Libyan Arab Jamahiriya)
Related Topics ... (or search in 1.720.883 topics !)
css-centering a table (2) centering table problems with css (7) css table overlap in mozilla (but not ie) (1) mozilla centering on a layer (2) mozilla centering problem with divs site (3) table not centering (8) ff table centering (3) centering a table (2) help centering a table (4)
copyright © 2007-2031 Pfodere.COM ( 5 Pfoyihuee Online )
|