SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    set table width using CSS?

    is there a way to set the table width using CSS?

    i've tried using "width: 100%" but it causes my nested tables to 'force' the containing table to increase in size and that causes the page to scroll sideways...

    any ideas what i'm doing wrong?

    Thanks!

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure but if you add this, does that make a difference:

    Code:
    position: relative;
    This makes the position of the element relative to the container element, so it would be 100% width of the containing element.
    But then again, logic doesn't always work .

  3. #3
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've had this prob a few times, but i managed to solve it without using css, though css looks like the most convenient way to solve it.

    To avoid this prob, next time, set your main [outermost] table to whatever fixed with you want, and ALL your inner nested tables with width size in percentage, %. This will surely prevent the unwanted increase in table width.

    hope this helps.
    asT.

  4. #4
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    setting 'position: relative' didn't work... i guess i'd have to go with asterick's suggestion and stick with using the width attribute in the <table> tag


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
  •