Results 1 to 6 of 6

Thread: Problems with centering a Div or Table

  1. #1
    Join Date
    May 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problems with centering a Div or Table

    Here is where you can view my problem: http://www.tclinc.com/newsite/

    the problem occurs with the header containing the navigation bar will not center. I'm using a css style sheet to center this and i've also added center tags onto the containing table and the object itself. I'm puzzled. By the way, this problem only occurs in IE6+

    thanks in advance for suggestions!

  2. #2
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Default

    Have you tried:
    HTML Code:
    <table align="center">
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    No, that would only center the table's content:
    Code:
    <div style="text-align:center;">
    <table>
    ...
    </div>
    - Mike

  4. #4
    Join Date
    Apr 2007
    Location
    Down the road from the store
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Or, if you REALLY want to make sure it centers across all browsers, set the DIV like this:

    Code:
    <div style="margin-right: auto; margin-left: auto; text-align: center;">
        <table>
            <tr>
                <td>
                    content
                </td>
            </tr>
        </table>
    </div>

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Or, equally:
    Code:
    margin:0px auto;
    - Mike

  6. #6
    Join Date
    Apr 2007
    Location
    Down the road from the store
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Duly noted, mburt - much more efficient (less typing) :P. tyvm.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •