Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Centering a table using only CSS

  • 17-05-2006 2:57pm
    #1
    Registered Users, Registered Users 2 Posts: 1,709 ✭✭✭


    Hey, I'm trying to centre a fixed width table using only CSS. I don't have any access to modify the HTML itself.

    Right now, all I've got to work with is a TABLE insidie a FORM inside the BODY of the document. I was able to centre using:
    form {
    	width: 750px;
    	margin-left: auto;
    	margin-right: auto;
    }
    
    but that only displayed correctly in Opera and Firefox, not IE.

    Is there any way to centre any of the three containers at a fixed width using CSS alone?

    If it's relevant, none of the mentioned objects have a class or id :(


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    add

    body {
    text-align: center; /* for IE */
    }


  • Registered Users, Registered Users 2 Posts: 1,709 ✭✭✭Balfa


    Thankyou Ph3n0m. Poifect!


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    on a side note, in IE, you may notice stuff aligning to the center - just specify text-align:left for whatever else you have on the page -- as sometimes in IE, the text-align:center cascades down and aligns everything in the middle that is not pegged down


  • Registered Users, Registered Users 2 Posts: 1,709 ✭✭✭Balfa


    I was somewhat confused as to why your solution worked, but eventually found http://dorward.me.uk/www/centre/ which explains it. :) Thanks again! :)


Advertisement