Dynamically increasing the div content [duplicate]

1

I have 3 div's and div2 must have dynamic content (growing as content is inserted into it), div1 must match the growth of div2. How can I do this?

    <div id="divPrincipal">
        <div id="div1" style="width:20%; background-color:gray;"></div>
        <div id="div2" style="width:80%"> Conteúdo dinâmico ... </div>
    </div>

Does anyone have an idea?

    
asked by anonymous 12.02.2016 / 21:11

1 answer

1

This is automatic, it took me a while to learn. The main div must be Absolute or Relative

position:relative;

or

position:absolute;

and the 2 div must be relative and the whole content inside as well. If it does not work the fault may be in the elements next to the main div that should be relative. Avoid using width or height by percentage but you can use width: 100% in both divs if you want the length of div 1 to be equal to that of div 2 and div 2 is below div 1. Be sure to use max-width and max-height with overflow: auto

    
12.02.2016 / 21:35