I want to create either a table or 3 separate divs, I don’t care which. All I’m trying to do is partition the screen into 20% on the top, 60% in the middle, and 20% on the bottom. I have somewhat accomplished that with the below code; however, if I make the font even remotely large in the top div or tr, it begins to invade on the space of the middle and bottom sections, and the page ends up not only having a larger top section than bottom section, it also goes off the bottom and adds a scroll bar. In other words, it’s ignoring my 20% height allocation, which is really cool and awesome.
body {
margin: 0px;
padding: 0px;
}
.small {
height: 20vh;
max-height: 20vh;
min-height: 20vh;
}
.large {
height: 60vh;
max-height: 60vh;
min-height: 60vh;
}
<body>
<table>
<tr class="small"></tr>
<tr class="large"></tr>
<tr class="small"></tr>
</table>
</body>
How do I enforce that 20% limit so that even if the font is larger in the top section, it doesn’t go and start allocating more space than I told it to?
2
Answers
If i understand correctly, You can achieve this layout using Grid.
Below i used three div and one main wraper.
20% on the top, 60% in the middle, and 20% on the bottom