<div id="container"> <div> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> <p>I will expand to fill extra space</p> </div> <div>HTML:
html, body { height: 100%; width: 100%; margin: 0px; } #container { height: 100%; width: 100%; min-height: 0px; display: flex; flex-direction: column; } #container > * { border: 1px solid black; margin: 0px; } #container > *:first-child { flex: 1; overflow-y: auto; }
JSFiddler: http://jsfiddle.net/e8n3hLmg/3/
Obs:
- para o scroll funcionar, foi necessário aplicar o atributo 'min-height' no container. Sem isso o scroll não funcionaria. no Stack Overflow (http://stackoverflow.com/a/28639686) tem uma resposta que explica o porquê.
Nenhum comentário:
Postar um comentário