How to center a table correctly

Discussion in 'HTML' started by Tassilo S. Schweiger, Dec 11, 2005.

  1. I want to make my homepages to be confirmed by http://validator.w3.org

    Now, a problem appears: How can I center a table correctly? Because the
    align="center" is not an attribute of <table> here.

    In CSS, the "text-align: center;" matches to IE, but is not matching to
    Opera and Firefox. Both browsers show the tables still left. Is there
    another attribute to center a table in CSS*?

    Thank you,
    Tassilo

    * I am sorry, I could not find any appropriate newsgroups for CSS.
     
    Tassilo S. Schweiger, Dec 11, 2005
    #1
    1. Advertising

  2. Tassilo S. Schweiger wrote:

    > Now, a problem appears: How can I center a table correctly? Because the
    > align="center" is not an attribute of <table> here.


    http://dorward.me.uk/www/centre/

    > In CSS, the "text-align: center;" matches to IE, but is not matching to
    > Opera and Firefox.


    That's a bug in IE. The text-align property centres inline content of block
    elements - it shouldn't change the position of a table at all.

    > Both browsers show the tables still left. Is there
    > another attribute to center a table in CSS*?


    There are no attributes in CSS. CSS has properties.

    > * I am sorry, I could not find any appropriate newsgroups for CSS.


    comp.infosystems.www.authoring.stylesheets

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Dec 11, 2005
    #2
    1. Advertising

  3. Tassilo S. Schweiger

    Curtis Guest

    Visit We the Thinking
    www.wethethinking.com
    An online magazine/forum
    devoted to ideas.
    Tassilo S. Schweiger <> wrote in message
    news:439bf800$0$9645$-online.net...
    > I want to make my homepages to be confirmed by

    http://validator.w3.org
    >
    > Now, a problem appears: How can I center a table

    correctly? Because the
    > align="center" is not an attribute of <table> here.
    >
    > In CSS, the "text-align: center;" matches to IE, but is

    not matching to
    > Opera and Firefox. Both browsers show the tables still

    left. Is there
    > another attribute to center a table in CSS*?
    >
    > Thank you,
    > Tassilo
    >
    > * I am sorry, I could not find any appropriate newsgroups

    for CSS.
    >


    This issue discussed in some detail here.

    http://theodorakis.net/tablecentertest.html

    --

    Curtis
     
    Curtis, Dec 11, 2005
    #3
  4. "David Dorward" wrote
    > http://dorward.me.uk/www/centre/


    Thank you. Then probably the most suitable should be "margin-left/right:
    auto".

    > That's a bug in IE. The text-align property centres inline content of
    > block
    > elements - it shouldn't change the position of a table at all.


    In fact, there are a lot of bugs in IE. For editing a page, you should not
    use IE. Because many mistakes are ignored. For viewing a page, it is somehow
    better, I think... Because then, everything is correct, even if it isn't
    really edited correctly ;-)

    > There are no attributes in CSS. CSS has properties.


    I am sorry! My native language is german.

    >> * I am sorry, I could not find any appropriate newsgroups for CSS.

    > comp.infosystems.www.authoring.stylesheets


    Ok, next time, I know. I only looked for "css".

    > David Dorward


    Tassilo
     
    Tassilo S. Schweiger, Dec 11, 2005
    #4
  5. "Curtis" wrote
    > This issue discussed in some detail here.
    > http://theodorakis.net/tablecentertest.html


    Thanks to you, too. Seems to be a very common difficulty to handle that one
    correctly...

    > Curtis


    Tassilo
     
    Tassilo S. Schweiger, Dec 11, 2005
    #5
  6. Tassilo S. Schweiger

    Curtis Guest

    Tassilo S. Schweiger <> wrote in message
    news:439c14ce$0$27888$-online.net...
    > "Curtis" wrote
    > > This issue discussed in some detail here.
    > > http://theodorakis.net/tablecentertest.html

    >
    > Thanks to you, too. Seems to be a very common difficulty

    to handle that one
    > correctly...
    >
    > > Curtis

    >
    > Tassilo
    >


    Check my latest post on this subject. We needed a rock-solid
    method which worked across the board and was applied to a
    single element, not the table AND a div method.

    We're trying <table style="margin-left: 15%; margin-right:
    15%; width: 70%;"> and variations of that. It lacks the
    flexibility of auto-sizing to the text, but so far it seems
    to work well on every browser for our needs. By changing the
    numbers, the table can be positioned left, right,
    center--and everywhere in between.

    I'd be glad to hear about any problems others might spot in
    this approach.

    --

    Curtis

    Visit We the Thinking
    www.wethethinking.com
    An online magazine/forum
    devoted philosophical
    thought.
     
    Curtis, Dec 12, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ALI-R
    Replies:
    4
    Views:
    19,692
    ALI-R
    Feb 14, 2005
  2. Rabbit
    Replies:
    1
    Views:
    2,778
    Shimon Sim
    Feb 12, 2006
  3. earl

    center table

    earl, Nov 11, 2003, in forum: HTML
    Replies:
    2
    Views:
    445
    David Dorward
    Nov 11, 2003
  4. ChChanges
    Replies:
    2
    Views:
    885
    Mitja
    Jun 16, 2004
  5. Anon
    Replies:
    2
    Views:
    968
    Jukka K. Korpela
    Mar 18, 2005
Loading...

Share This Page