I know my problem has to do with Understanding flexbox and overflow:auto but I can't for the life of me fix it...
I have a pretty complex structure which I've simplified to the maximum to display the "wrong" behaviour that I'm getting. Here it is: https://jsfiddle.net/8yv7aq1k/ [Edit: there is another version https://jsfiddle.net/8yv7aq1k/3/ which shows the problem better]
Basically, the "workspace" zone doesn't size to its content and so the absolutely positioned element "playbar" doesn't size to the 100% that I would like.
Can any CSS ninja help me out here... been stuck on this for a while.
Thanks
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
}
html {
body {
.wrapper {
height: 100%;
display: flex;
flex-direction: column;
background-color: red;
padding: 20px;
.track-list-and-workspace {
position: relative;
flex: 1;
overflow-x: hidden;
overflow-y: auto;
display: flex;
.workspace {
flex: 1;
position: relative;
display: flex;
flex-direction: column;
padding: 10px;
background-color: green;
.content {
background-color: white
}
.playbar {
position: absolute;
left: 50px;
top: 0;
height: 100%;
width: 10px;
background-color: black;
}
}
}
}
}
}
<body>
<div class="wrapper">
<div class="track-list-and-workspace">
<div class="workspace">
<div class="playbar"></div>
<div class="content">
test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/> test
<br/>test<br/> test
<br/>
</div>
</div>
</div>
</div>
</body>
Edit: This version speaks better of the problem: https://jsfiddle.net/8yv7aq1k/3/
I need the scrolling to take place at .track-list-and-workspace
level.
Edit2: Forgot to mention that there is a simple solutions using floats that I am using hoping I can find something better with flexboxes https://jsfiddle.net/8yv7aq1k/4/