#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    15
    Rep Power
    0

    Question Positioning with CSS


    I have a table not long enough to fill the page. I want the table to always be in the middle of the page at no matter what resolution. I know that for text I could just have <td valign="middle"> but how can I do the same but for a table using CSS? Is there a variable where I can check the size of the screen and align it that way?

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Rhondda Cynon Taff, Wales
    Posts
    172
    Rep Power
    12
    try either the position:relative or postion:absolute positioners.
    Ryan Jones (RyanJ)
  4. #3
  5. Thanks Johnny Hart (BC) R.I.P.

    Join Date
    May 2003
    Location
    Dallas
    Posts
    5,268
    Rep Power
    1956
    Look here for an example of centering a <div> horizontally and vertically in the window. Use the div as a container for your page. This little exercise is not pure CSS, it uses a single cell table as the outer container. I generally don't use tables for layout, but if you want vertical centering, this seems to be the only elegant hack.

    cheers,

    gary
    There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing.

    My html and css workshop, demos and tutorials.
    Ask a better question, get a better answer.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    15
    Rep Power
    0
    Thanks in a million! I surely appreciated you sharing your knowledge.

IMN logo majestic logo threadwatch logo seochat tools logo