javascript - HTML - Make table minimum height matches the current screen height -
i designing web page using table, layout looks following:
<html> <head> </head> <body> <table> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> </table> </body> </html>
i need table minimum height match screen height, when content height less screen height should match screen height adding space in middle row.
what simplest way achieve this?
do not use <table>
elements layout. in fact, css3 flexbox specification created layout requirements yours—the trick use display flex on parent element, , ensure row want fill minimum height allowed grow, using flex-grow: 1
. parent should have minimum height of 100vh
.
body { padding: 0; margin: 0; } div.content-wrapper { display: flex; flex-direction: column; min-height: 100vh; } div.row-2 { background-color: #333; color: #eee; flex-grow: 1; }
<div class="content-wrapper"> <div class="row-1">row 1</div> <div class="row-2">row 2</div> <div class="row-3">row 3</div> </div>
Comments
Post a Comment