how to center a complete table?

Discussion in 'HTML' started by Christian Stüben, Dec 14, 2007.

  1. Hi all,
    the problem i have is that i have to center a table on a website. Both for
    screen and for printing. Only with ie i can center the table, all other
    browsers leave the table at the left border. Until now, i have some
    workaround and place the table at an absolute position using some css-class.
    But every time the page size changes, i have to change my css file too.

    Any hints how i can center the table?

    greetings from germany
    Chris
     
    Christian Stüben, Dec 14, 2007
    #1
    1. Advertising

  2. Christian Stüben wrote:

    > the problem i have is that i have to center a table on a website. ...
    > Any hints how i can center the table?


    Perhaps if you posted the URL to your best effort so far, advice could
    be given.

    --
    -bts
    -Friends don't let friends drive Vista
     
    Beauregard T. Shagnasty, Dec 14, 2007
    #2
    1. Advertising

  3. "Beauregard T. Shagnasty" <> schrieb im
    Newsbeitrag news:9uw8j.46017$...
    > Christian Stüben wrote:
    >> the problem i have is that i have to center a table on a website. ...
    >> Any hints how i can center the table?

    > Perhaps if you posted the URL to your best effort so far, advice could
    > be given.


    Ok, here it is...
    www.drucke-meinen-kalender.de/druck2008.aspx
    The problem is the calendar table below the picture.

    If you want to make a complete "printout", try www.drucke-meinen-kalender.de
    upload the pictures, and press start printing. Until now, the pages are only
    german, english translation will come later. And yes, i know, the screen
    layout is ugly ugly ugly ;-)

    greetings from germany
    Chris
     
    Christian Stüben, Dec 14, 2007
    #3
  4. Christian Stüben

    a-ok-site Guest

    On Dec 14, 8:46 am, Christian Stüben <> wrote:
    > "Beauregard T. Shagnasty" <> schrieb im
    > Newsbeitragnews:9uw8j.46017$....
    >
    > > Christian Stüben wrote:
    > >> the problem i have is that i have to center a table on a website. ...
    > >> Any hints how i can center the table?

    > > Perhaps if you posted the URL to your best effort so far, advice could
    > > be given.

    >
    > Ok, here it is...www.drucke-meinen-kalender.de/druck2008.aspx
    > The problem is the calendar table below the picture.
    >
    > If you want to make a complete "printout", trywww.drucke-meinen-kalender.de
    > upload the pictures, and press start printing. Until now, the pages are only
    > german, english translation will come later. And yes, i know, the screen
    > layout is ugly ugly ugly ;-)
    >
    > greetings from germany
    > Chris


    <center>table here</center> would be the easiest.

    You really need to validate the page

    http://validator.w3.org/check?verbo.../(S(twomsdfzfrnbtq55r2exmou0))/druck2008.aspx

    Daniel

    http://a-ok-site.com
     
    a-ok-site, Dec 14, 2007
    #4
  5. a-ok-site wrote:

    > <center>table here</center> would be the easiest.
    >


    In 1996, but not preferred practice today.

    For tables with set width as will all block elements you center them
    within their containers via margins:

    table { margin-left: auto; margin-right: auto; }

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Dec 14, 2007
    #5
  6. Christian Stüben

    a-ok-site Guest

    On Dec 14, 10:05 am, "Jonathan N. Little" <>
    wrote:
    > a-ok-site wrote:
    > > <center>table here</center> would be the easiest.

    >
    > In 1996, but not preferred practice today.
    >
    > For tables with set width as will all block elements you center them
    > within their containers via margins:
    >
    > table { margin-left: auto; margin-right: auto; }
    >
    > --
    > Take care,
    >
    > Jonathan
    > -------------------
    > LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com


    It works and was easy. There is no part of that page that is
    preferred practice.
     
    a-ok-site, Dec 14, 2007
    #6
  7. "a-ok-site" <> schrieb im Newsbeitrag
    news:...

    > <center>table here</center> would be the easiest.


    Often, the solution is nearer than you think ;-) Thanks.
    But ... visual studio allways told me that <center> is obsolete and should
    be replaced by other constructs. And selfhtml too tells it is deprecated.
    http://de.selfhtml.org/html/text/bereiche.htm#block_zentriert
    So i have been searching for the "other construct". Until i found a solution
    by css or something else, i have switched back to <center>. It is now
    online.

    > You really need to validate the page


    Ehem, yes. But again ... there i depend on what visual studio and iis and
    asp dot net are generating.

    greetings to all
    Chris
     
    Christian Stüben, Dec 14, 2007
    #7
  8. Scripsit a-ok-site:

    >>> <center>table here</center> would be the easiest.

    - -
    > It works and was easy.


    This just indicates lack of testing. You only viewed it on faulty
    browsers.

    If you wanted to be quick and dirty, you could have used
    <table align="center">
    which is actually easier and has the defined (and factual) effect of
    centering the table, without affecting the centering of lines within
    table cells.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Dec 14, 2007
    #8
    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:
    884
    Mitja
    Jun 16, 2004
  5. Anon
    Replies:
    2
    Views:
    968
    Jukka K. Korpela
    Mar 18, 2005
Loading...

Share This Page