Firefox, Div tags, Tables and Centering problems  | Site Moderator | | Join Date: Oct 2006 Location: The Great White North
Posts: 5,137
| |
Hi there!
I don't know why I seem to be the only one with this problem...In Firefox when I'm displaying a table within a <div> and use the align="center" it does not center the table. I'm wondering if there is a way around this...
Eg -
<div id="mainContent">
-
<table align="center">
-
...
-
</table>
-
</div>
-
Thanks for your help!
-Frinny
| | Expert | | Join Date: Oct 2006 Location: NC
Posts: 1,722
| | | re: Firefox, Div tags, Tables and Centering problems Quote:
Originally Posted by Frinavale Hi there!
I don't know why I seem to be the only one with this problem...In Firefox when I'm displaying a table within a <div> and use the align="center" it does not center the table. I'm wondering if there is a way around this...
Eg -
<div id="mainContent">
-
<table align="center">
-
...
-
</table>
-
</div>
-
Thanks for your help!
-Frinny Hey Frinny glad to see you made your way to the HTML forum! -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-
<html>
-
<head>
-
<title>STUFF</title>
-
<style type="text/css">
-
.clsTest
-
{
-
/* Centers in FF */
-
text-align: -moz-center;
-
/* Centers in IE */
-
text-align: center;
-
}
-
-
</style>
-
</head>
-
<body>
-
<div class="clsTest">
-
<table style="border: 2px solid black">
-
<tr>
-
<td>Some Crap</td>
-
</tr>
-
</table>
-
</div>
-
</body>
-
<html>
-
|  | Expert | | Join Date: Sep 2006
Posts: 5,577
| | | re: Firefox, Div tags, Tables and Centering problems
align="center" is deprecated. Don't use it.
He wants to center the table, not the text. With typos fixed: -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-
<html>
-
<head>
-
<title></title>
-
<style type="text/css">
-
-
table
-
{
-
margin:0 auto;
-
}
-
-
</style>
-
</head>
-
<body>
-
<div class="clsTest">
-
<table style="border: 2px solid black">
-
<tr>
-
<td>Some Crap</td>
-
</tr>
-
</table>
-
</div>
-
</body>
-
</html>
-
| | Expert | | Join Date: Oct 2006 Location: NC
Posts: 1,722
| | | re: Firefox, Div tags, Tables and Centering problems Quote:
Originally Posted by drhowarddrfine With typos fixed: </html> :)
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: Firefox, Div tags, Tables and Centering problems Quote:
Originally Posted by AricC - ...
-
<title>STUFF</title>
-
... <td>Some Crap</td>
-
...
Aric, could you not think of better test words?!
|  | Site Moderator | | Join Date: Oct 2006 Location: The Great White North
Posts: 5,137
| | | re: Firefox, Div tags, Tables and Centering problems Quote:
Originally Posted by drhowarddrfine ... -
<style type="text/css">
-
-
table
-
{
-
margin:0 auto;
-
}
-
-
</style>
-
Thanks so much its working perfectly now :)
-Frinny
|  | Expert | | Join Date: Sep 2006
Posts: 5,577
| | | re: Firefox, Div tags, Tables and Centering problems
That's just the kind of guy I am. Perfect.
| | Expert | | Join Date: Oct 2006 Location: NC
Posts: 1,722
| | | re: Firefox, Div tags, Tables and Centering problems Quote:
Originally Posted by acoder Aric, could you not think of better test words?! I changed it, whooops LMAO sorry guys yesterday was a completely heinous work day. The kind where you go straight to the pub after work. Which I did, today should be better :) Thanks for the fix Doc I wouldn't want to look like a total arse!
Aric
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|