0

Hi there,
is there any way to adjust the width of outer div automatically?
e.g.

<div class="outer"><div class="inner">test</div></div>

What I want is that the width of outer could be set automatically according to the content of inner so that I do not have to set the value by myself.

4
Contributors
9
Replies
13
Views
6 Years
Discussion Span
Last Post by Dandello
0

Basically, all divs want to be 100% the width of their container unless given a smaller width. So to answer your question, no. But the width of the contents inside the inner div will also have no effect on the width of that div - they will simply run outside the container.

0

Basically, all divs want to be 100% the width of their container unless given a smaller width. So to answer your question, no. But the width of the contents inside the inner div will also have no effect on the width of that div - they will simply run outside the container.

OK, I see. Thanks.

0

Basically, just assign CSS 'overflow:hidden' to the outer div. With this, the outer div will auto size in tern of width and height based on content of inner div without have to set fixed width.

0

Basically, just assign CSS 'overflow:hidden' to the outer div. With this, the outer div will auto size in tern of width and height based on content of inner div without have to set fixed width.

It does not work. There is still an empty area shown....

0

create the div class with "width:auto;"... this will help you
example:
Html:
<div class="outer">.........Document........</div>
css class for div:
outer{
min-width:1024px;
width:auto;
height:auto;
}

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.