By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

Center Tables with CSS

P: n/a
Hi,

I have a very crazy problem with CSS. I have tried to center my tables
with
TABLE {margin-left:auto; margin-right:auto}
how it is described in many other postings.
Mozilla and Konqueror are accepting this way of centering the table
but not IE.
I also tried
TABLE {margin-left: 0 auto}
which I have seen recently, too. But nothing works.

Had anyone the same problem and can help me. If not, I have to center
the tables with the "align" attribute. But if it's possible I want to
avoid that.

Bye

Bastian
Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a


Bastian wrote:
I have a very crazy problem with CSS. I have tried to center my tables
with
TABLE {margin-left:auto; margin-right:auto}
how it is described in many other postings.
Mozilla and Konqueror are accepting this way of centering the table
but not IE.


I think IE6/Win should do the right thing with that CSS if you make sure
your document is rendered in CSS standards-compliant mode
http://msdn.microsoft.com/library/de...hancements.asp
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
Els
Bastian wrote:
Hi,

I have a very crazy problem with CSS. I have tried to center my tables
with
TABLE {margin-left:auto; margin-right:auto}
how it is described in many other postings.
Mozilla and Konqueror are accepting this way of centering the table
but not IE.
I also tried
TABLE {margin-left: 0 auto}
which I have seen recently, too. But nothing works.

Had anyone the same problem and can help me. If not, I have to center
the tables with the "align" attribute. But if it's possible I want to
avoid that.


For IE5 (and 4) you will need the center:align; property in
the style of the parent element.
http://locusmeus.com/html-css/centeringpage.html is about
centering a page, but the same principle goes for tables,
I'd think.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -

Jul 20 '05 #3

P: n/a
Bastian wrote:
I have a very crazy problem with CSS.
comp.infosystems.www.authoring.stylesheets is a couple of doors along, this
is the html authoring newsgroup.
I have tried to center my tables
with
TABLE {margin-left:auto; margin-right:auto}
how it is described in many other postings.
Mozilla and Konqueror are accepting this way of centering the table
Yup, they are good browsers.
http://dorward.me.uk/www/centre/#block
but not IE.
You are probably using an obsolete version of IE, or are failing to trigger
standards mode.

http://dorward.me.uk/www/centre/#ie explains the work arounds.
I also tried
TABLE {margin-left: 0 auto}


This means the same as:

margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #4

P: n/a
David Dorward <do*****@yahoo.com> wrote:
I also tried
TABLE {margin-left: 0 auto}


This means the same as:

margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;


Margin-left only takes one value, correct usage: "margin:0 auto".

--
Spartanicus
Jul 20 '05 #5

P: n/a
Els
Spartanicus wrote:
David Dorward <do*****@yahoo.com> wrote:
I also tried
TABLE {margin-left: 0 auto}


This means the same as:

margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;


Margin-left only takes one value, correct usage: "margin:0 auto".


I just looked at this sentence of yours, and the code above,
and again, and once more.. and then I saw the difference.

Funny how you see what you're expecting to see, while it's
not really there ;-)

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -

Jul 20 '05 #6

P: n/a
Spartanicus wrote:
Margin-left only takes one value, correct usage: "margin:0 auto".


Whoops - misread the previous post.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.