I am trying to make a layout, which should occupy the height of header and footer leaving rest to the main container. ( sidebar, content ). but not able to archive this. any one help me?
I do not have fixed height for both header and footer. ( it should only occupy content height )
.container {
display: grid;
grid-template-rows: auto auto auto;
grid-template-columns: 100px auto;
grid-template-areas:
"header header"
"sidebar content"
"footer footer";
height: 100vh;
}
.header { grid-area: header; background-color: yellow; }
.sidebar { grid-area: sidebar; background-color: gray; }
.footer { grid-area: footer; background-color: green;}
.content { grid-area: content; }
<div class="container">
<div class="header">header should shrink with it's content</div>
<div class="sidebar">it should be rest of the height from header and footer</div>
<div class="footer">footer should shrink with it's content</div>
<div class="content">
<p>it should be rest of the height from header and footer</p>
</div>
</div>
</div>