Search code examples
csshtmlresizestretching

Stretching and resize a div dynamically


I am trying to stretch div as soon as some text is loaded.I am able to do that by giving min-height:140 px and height:100% to its parent container. But content in my div is crossing its parent container. How can I limit the inner div so that it will not cross its parent container.

Please help me as I am trying for it from so long.

thanks in advance

HP


Solution

  • Use the overflow attribute in your CSS.

    #myDiv {
        overflow:auto;
    }
    

    Depending on the width you assign, this will get the nested div to display a scrollbar once it's width exceeds that of its parent.