|
| |
|
|
Chugachman
Posts: 63 Joined: 2/8/2004 From: Alaska Status: offline
|
Table Center - 12/26/2004 4:15:29
What is the correct syntax in CSS so that a table is centered on the page. Much obliged...happy holidays!
|
|
|
|
d a v e
Posts: 4166 Joined: 7/24/2002 From: England (but live in Finland now) Status: offline
|
RE: Table Center - 12/26/2004 6:06:22
this http://members.tiscali.fi/dave_pirjo/test-area/css_stuff/table_centred.htm basically to centre a block level element such as a table use margin:0 auto; it won't work in IE if you use a transitional doctype (then you have to use the center attribute on the table element) but if you're using strcit (x)html it works fine., but that's just cos IE is crap.
_____________________________
David Prescott Gekko web design
|
|
|
|
Chugachman
Posts: 63 Joined: 2/8/2004 From: Alaska Status: offline
|
RE: Table Center - 12/26/2004 13:03:40
I'm sorry, I didn't communicate well. What would I write on a CSS style sheet so that all tables are centered on the page. I can't find it in any of my reference books. Thanks!
|
|
|
|
Giomanach
Posts: 6128 Joined: 11/19/2003 From: England Status: offline
|
RE: Table Center - 12/26/2004 21:15:35
quote:
it won't work in IE if you use a transitional doctype (then you have to use the center attribute on the table element) but if you're using strcit (x)html it works fine., but that's just cos IE is crap. A bit more CSS will solve that bug... CSS: html, body{ text-align: center; } #page{ margin: 0 auto; width: 775px; text-align: center; } HTML: <html> <head> <title>Page 1</title> <link type="text/css" rel="stylesheet" href="01.css"> </head> <body> <div id="page"> <table> ....Table coding..rows, cells etc.... </table> </div> </body> </html> works in all browsers without fail =)
_____________________________
|
|
|
|
d a v e
Posts: 4166 Joined: 7/24/2002 From: England (but live in Finland now) Status: offline
|
RE: Table Center - 12/28/2004 16:09:37
but you would have to remember to explicitly set any descendants of html, body, #page as left aligned unless you wanted those centred too - probably!
_____________________________
David Prescott Gekko web design
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|