Re: Basic (?) CSS question



On Sun, 25 Jan 2009 21:50:58 -0500, Padmar Mushkin <x@xxx> wrote:

I have a page with 2 columns. The right column is fixed width, and I
want the left column's width to expand to fit the remaining space.

I used to do this with a table, but 'm trying to learn to do things
the right way with CSS, but I can't seem to get it to work. Both
columns are DIVs; I've tried floating them, absolute positioning them,
setting the left column's width to 100%; not setting the width. But
the columns end up either overlapping, or the right column appears
below the left column.

Put both in a container. Set the width of the container to what ever.
Then define the width of the left div.

<div style="width:100%;"> <<< container
<div style="float:left; width:20%;"> <<<left div.</div>
<div style="float:left;">data</div>
</div>
.



Relevant Pages

  • Re: Does height 100% work with html 401 strict?
    ... The side divs still wouldn't expand. ... your floats have a set width but a width without any height is ... shrink to fit as far as height is concerned, ...
    (alt.html)
  • secure storage of valuables
    ... I am considering moving to latin america from texas. ... could fit the stuff into an area of 10'x10' floor space, ... CONTAINER WITH A TRUSTED PERSON WOULD BE PREFERRED METHOD, ...
    (misc.survivalism)
  • Re: redraw pictureboxes in image????
    ... Of course that can be done (up to the point where the container is too large to fit onto the screen) or of course you could take a different approach and have the contents automatically resize themselves so that they fit into the container. ... Up to this point you have given the impression that you want the images to always remain at a fixed size and the assumption was that you therefore also wanted the container to remain at a fixed size. ...
    (microsoft.public.vb.general.discussion)
  • Re: 4 centered columns
    ... even though it did the first time. ... and a reason that IE cannot fit 4 25% divs on the ... Anyway, there must be a better way to center all this than javascript, ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: padding problem..
    ... Normal-flow auto width depends only on the container and is greedy. ... Normal-flow auto height depends on the contents and is conservative. ... auto height shrink to fit according to content. ...
    (comp.infosystems.www.authoring.stylesheets)