Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 19th, 2004, 11:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default table tag

Hi there

What is the css tag for aligning a table to center? I've tried align:center and it's not working.

thanks

Adam

PS - where can I find a list of css commands?

 
Old October 19th, 2004, 12:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

<table align="center">

I would have thought align:center would work; horizontal-align:center maybe??? Other than that, no idea.

Brian
 
Old October 19th, 2004, 12:19 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

align="center" is not CSS, it's markup.

For the CSS method, this depends on whether you are facing quirks mode or standards mode.

The following centers a table.
table {
    margin: auto;
}

If you are facing quirks mode in IE, then you must apply text-align: center; on the containing block.

div {
    text-align: center; /* For IE Quirks and older IE's */
    border: 1px solid black;
}
table {
   margin: auto; /* For all other browsers */
   border: 1px solid black;
}

<div>
    <table>
         <tr>
           <td>test</td>
         </tr>
    </table>
</div>

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old October 19th, 2004, 12:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

great, thanks guys

 
Old April 6th, 2005, 08:29 PM
Authorized User
 
Join Date: Sep 2003
Location: Melbourne, Victoria, Australia.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Richard your a Gem,

I am trying desparatly to get my site correct by removing stuff that is depreaciated and have had various degrees of success with this problem, Now I have the answer

www.britishsteam.com

Thanks Topshed





Similar Threads
Thread Thread Starter Forum Replies Last Post
<b> tag for getting a rounded corner table? Cyber Shiva HTML Code Clinic 1 March 13th, 2007 05:23 AM
HTML tag from C# or ASP.NET tag from javascript angshujit ASP.NET 2.0 Basics 3 February 16th, 2007 10:07 AM
HTML tag vs Body Tag CFGerry BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 October 7th, 2005 07:13 AM
Trying to output a tag within a tag jaucourt XSLT 3 January 12th, 2005 11:57 AM
padding not working in table tag peter_vansteen@hotmail.co HTML Code Clinic 1 September 17th, 2003 08:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.