I\'m trying to make the parent div only as wide as the child div\'s. Auto width is making the parent div fit the entire screen. The children divs will be different widths depend
The parent div (I assume the outermost div) is display: block
and will fill up all available area of its container (in this case, the body) that it can. Use a different display type -- inline-block
is probably what you are going for:
http://jsfiddle.net/a78xy/
Your interior <div>
elements should likely both be float:left
. Divs size to 100% the size of their container width automatically. Try using display:inline-block
instead of width:auto
on the container div. Or possibly float:left
the container and also apply overflow:auto
. Depends on what you're after exactly.