I have the following layout defined with flexbox. I'd like for the buttons on the right to be placed inside a horizontal scrolling element:
However, as I add addition buttons, rather than scrolling, the container expands:
The code is defined as:
<div class="container">
<main>
</main>
<aside>
<section>
<button>button 1</button>
<button>button 2</button>
<button>button 3</button>
<!-- adding additional buttons causes the container to expand in width rather than scroll -->
<!--
<button>button 4</button>
<button>button 5</button>
-->
</section>
</aside>
</div>
CSS (SCSS):
.container {
display: flex;
flex-direction: row;
height: 90vh;
main {
background: lightblue;
flex: 0 0 40vw;
}
}
aside {
background: lightcoral;
flex: 0 0 40vw;
section {
display: flex;
overflow-x: scroll;
button {
width: 150px;
height: 20px;
}
}
}
Here's a jsfiddle demo of the issue: