I have a sidebar menu with variable size. It has a random amount of menuheaders and items. After this menu a <div>
should cover the remaining height.
I tried this solution and it would work, but there is a padding on the <div class="menucell">
element (grey space in the fiddle).
How can I remove this padding? Or are there better solutions for this task?
.menurow {
display: table-row;
vertical-align: top;
box-sizing: border-box;
}
.menucell {
display: table-cell;
padding: 0;
vertical-align: top;
}
.menu {
position: fixed;
display: table;
box-sizing: border-box;
width: 300px;
height: calc(100vh - 20px);
background-color: rgba(0, 0, 0, 0.1);
}
.menuSubheader {
height: 15px;
padding: 8px 5px 8px 15px;
font-size: 12px;
line-height: 15px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
position: relative;
background-color: rgba(0, 0, 255, 0.3);
}
.itemList {
width: 300px;
height: auto;
z-index: 80;
background-color: rgba(0, 0, 255, 0.1);
}
.item {
height: 15px;
padding: 5px 5px 5px 15px;
background-color: rgba(255, 255, 255, 0.8);
}
.buffer {
width: 300px;
margin-top: 10px;
overflow: hidden;
text-align: center;
display: table-cell;
align-content: center;
vertical-align: middle;
color: rgba(211, 47, 47, 0.5);
background-color: rgba(211, 47, 47, 0.1);
border: 2px dashed rgba(211, 47, 47, 0.3);
}
<div class="menu">
<div class="menurow">
<div class="menucell">
<div class="menuSubheader"><span>Header1</span></div>
<div class="itemList">
<div class="item"><span>Item</span></div>
<div class="item"><span>Item</span></div>
<div class="item"><span>Item</span></div>
</div>
<div class="menuSubheader"><span>Header2</span></div>
<div class="itemList">
<div class="item"><span>Item</span></div>
<div class="item">
<span>Item</span>
</div>
</div>
<div class="menuSubheader" data-visible="false"><span>Header3</span></div>
<div class="itemList">
<div class="item"><span>Item</span></div>
<div class="item"><span>Item</span></div>
<div class="item"><span>Item</span></div>
</div>
</div>
</div>
<div class="buffer">
<span>please fill parent height</span>
</div>
</div>