At 6/26/2009 12:58 PM, Stevio wrote:
Is it possible to expand a container's width to fit its content?

For example, if I have a page where the content is wider than the width available at the browser's current size, which means the horizontal scrollbar appear, I want the container to expand to fit the width of the content instead of having the content sticking out the side (because that makes the design of the page look poor when the user scrolls horizontally).

It's always a good idea to include a link to a page where your problem is actually occurring so we can give you pertinent advice.

Speaking in generalities, normal behavior is for a container to stretch to contain its content. However, if content is floated left or right or positioned absolutely or relatively, it's taken out of the flow and can visually extend beyond the boundaries of its containing block. The solution is often to float or relatively position the container. If the problem is that you've absolutely positioned your content, I would further recommend that you rethink that plan, as in most cases absolute positioning is an unnecessary, brute-force approach to solve a problem that can be handled much more gracefully with different styling.



Paul Novitski
Juniper Webcraft Ltd.

List Guidelines:

Reply via email to