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).


Hey Stevio,

Without seeing a real example of what you are trying to achieve, it sounds like setting your container to a percentage width should do the job. Eg: #container { width: 100%; }

It will then expand and contract to the width of the browser window (or the width of a parent element if this parent has a width specified). Content will wrap inside this container as needed.


List Guidelines:

Reply via email to