Results 1 to 3 of 3

Thread: Aligning Tables [Resolved]

  1. #1

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650

    Aligning Tables [Resolved]

    I want to align a table with a style sheet. I know how to do it with images, but when i set the table it just go's to the top of the page, turns slighlty transparent, and gets the highest z order. Does anyone know how to do this. Here is what I am using now:

    table {position:absolute}
    table.news {left:0;top:100}

    I placed that into a style sheet that I link to, and it doesnt work. Nor does it work when it internal. Any help would be appreciated.
    Last edited by Mushroom Realm; Feb 22nd, 2003 at 03:07 PM.

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    It's a bit hard to say without the context of where the table is in your page. Also do you mean vertical or horizontal alignment? Horizontal can be done something like this:

    Code:
    <div style="text-align: center;">
      <table style="margin: 0 auto; width: 85%; text-align: left;">
        ...
      </table>
    </div>
    You are supposed to do alignment with margin: 0 auto, but IE being IE gets it all wrong, and you have to use text-align (which is meant for inline stuff only). So to counter-act that effect in decent browsers to need to encase the table in a div which has centre alignment, then reset it on the table itself and specify the margin there. I think that should work.

    By the way "top:100" should be "top:100px" as you must specify a unit if the value of anything other than 0, and it probably won't work in much other than IE.

  3. #3

    Thread Starter
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650
    I didn't test that, but I figured it out. I was using page as the class name. I guess page is a restricted word, so the browser was setting the top to 0 (I had position:absolute on). I just changed the class name and now it works fine. I didnt have to use a DIV tag either.

Posting Permissions

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



Click Here to Expand Forum to Full Width