I would like to create a side menu which is a narrow right sidebar with icons in it in a column. There could be more icons/buttons then the available vertical space and what I would like to achieve is to show those icons on hovering over the sidebar and the leftover icons would be expanded to the Left! Please run the snippet for a demo. My problem is that the icons which doesn't have enough space on the sidebar are wrapped to the left into a new column because of the flex rules I applied and these are right, but those elements wont have the sidebar's background which is bad. I hope my problem is clear. Thanks
.container {
width: 400px;
height: 200px;
background-color: grey;
display: flex;
flex-direction: row;
}
.content {
width: 100%;
margin: 20px;
border: 1px solid red;
margin: 10px;
}
.sidebar {
background-color: lightgrey;
display: flex;
flex-flow: column wrap-reverse;
overflow: hidden;
}
.sidebar:hover { overflow: visible; }
.icon {
width: 20px;
height: 20px;
padding: 5px;
}
.icon path { fill: white }
<div class="container">
<div class="content">hover over sidebar</div>
<div class="sidebar">
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
<img class="icon" src="http://cdn.onlinewebfonts.com/svg/img_98883.svg" />
</div>
</div>