s.singh s.singh - 1 year ago 84
jQuery Question

why only height is adjustable of parent div if child div is resizeable?

I am new in html development . I sharing my simple code which have two div . one div is parent div and second div is it's child div .So now problem is that when I resizing child div only height is adjustable but when I resizing chid div to right side width of parent div not adjustable but I want it . So please anyone help me . following is my code :

<div style='border:1px solid;padding:20px;width:auto;height:auto;'>
<div style="resize: both;overflow:auto;border:1px solid;width:500px;height:200px;"/>

Answer Source

You just have to use display: inline-block.

.first {
  border:1px solid;
  display: inline-block;
.second {
  resize: both;
  border:1px solid;
<div class="first">
<div class="second"></div>

</div><!-- /.first -->

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download