tags:

views:

267

answers:

5
A: 

Your container is fixed width and won't grow. What you're probably looking for is min-width. In other words, change:

width:970px;

to:

min-width:970px;

As a note, IE 6 and 7 treat width as min-width, but other browsers do not.

John Cavan
ok thanks anything on the height?
CmdrTallen
I think you meant it the other way around. IE6 doesn't understand min-width. It treats it just like width.
Brian Kim
A: 

I think you need this in your CSS:

overflow: auto;
Scott S.
http://www.w3schools.com/Css/pr_pos_overflow.asp has other options and info related to this.
Scott S.
Its weird to me how this does expand the container but shows scrollbars both vert and horz. Seems there should be a way to just make the background container resize and not put up scrollbars.
CmdrTallen
There is. Overflow:hidden.
D_N
+2  A: 
.container { overflow:hidden; }

assuming you are dealing with floats, this is one way to make the container actually contain them.

meder
A: 

Depending on your float situation for the container and the inside grid, you can do a number of different things. You might be able to get away with just adding a clear,

clear:both;

You also can float the parent. This is called, setting a float to fix a float. So if your grid has a

float:left;

Then you can just add

float:left;

to your container css. I really like the Complex Spiral article on containing floats.

Rob Lund
+2  A: 

I've seen this happen many times when you have floats inside. Add a clearing div just before closing container. You should always clean up after floats.

<div class="container">
  <div id="nav" style="float:left;">
  ...
  </div>
  <div id="grid" style="float:left;">
  ...
  </div>
  <div style="clear:both;"></div> <!-- this does the trick -->
</div>

I disagree with adding float to container. Although this will work, having unnecessary floats will give you more problems down the road. Only use floats where necessary and clear it when done floating.

Also in my experience, overflow doesn't mean anything here unless you define height. I don't think setting overflow on container fixes the issue here. Correct me in the comments if I'm wrong.

Brian Kim
Adding overflow:hidden automatically contains floats. (It's much easier than clearfix, too.) If you have a height declared, it will cut it off--if not, just contain them. Of course, then nothing else can escape the container either. +1 for advising against floating everything, though.
D_N