how to center a complete table?

C

Christian Stüben

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
 
B

Beauregard T. Shagnasty

Christian said:
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.
 
C

Christian Stüben

Beauregard T. Shagnasty said:
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
 
A

a-ok-site

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
 
J

Jonathan N. Little

a-ok-site said:
<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; }
 
A

a-ok-site

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; }

It works and was easy. There is no part of that page that is
preferred practice.
 
C

Christian Stüben

<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
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
 
J

Jukka K. Korpela

Scripsit a-ok-site:
- -
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top