Controlling size of div based on content

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ryan.champlin@firstlogic.com

    Controlling size of div based on content

    I've created a div tag that has overflow set to scroll in my css file.
    Now I've embedded a table inside of that div. However, a div always
    expands to the size of it's container. Here the whole width of the
    browser. Thus, the scroll bar shows up way at the right and the data
    in the table stops short. I'd like the DIV to only get as wide as the
    table which I have nested inside of it. Is there a way to get the DIV
    tag to do this so the scroll bar looks correct.

    Thanks,
    Ryan

  • Johannes Koch

    #2
    Re: Controlling size of div based on content

    ryan.champlin@f irstlogic.com wrote:[color=blue]
    > I've created a div tag that has overflow set to scroll in my css file.
    > Now I've embedded a table inside of that div. However, a div always
    > expands to the size of it's container. Here the whole width of the
    > browser. Thus, the scroll bar shows up way at the right and the data
    > in the table stops short. I'd like the DIV to only get as wide as the
    > table which I have nested inside of it. Is there a way to get the DIV
    > tag to do this so the scroll bar looks correct.[/color]

    Why don't you put the overflow property on the table selector?
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)

    Comment

    Working...