In the following example:
html {
height: 100%;
}
body {
height: 100%;
margin: 0;
}
#main {
height: 100%;
margin: 0;
display: flex;
flex-direction: row;
}
#whiteboard {
flex: 1 1 auto;
background-color: LightGreen;
display: inline-flex;
flex-direction: column;
}
#whiteboardPanel {
display: inline-flex;
overflow: auto;
}
#whiteboardContent {
height: 1000px;
width: 100px;
background-color: White;
}
<div id="main">
<div id="whiteboard">
<div id="whiteboardPanel">
<div id="whiteboardContent">Blah, blah, ...</div>
</div>
<div>Some buttons here</div>
</div>
</div>
The scrollbar appears at the right of the window. I like to have it touching the white part, that is, touching the content of the div "whiteboardPanel".
The problem appears seems to be because "whiteboardPanel" grows till use all the window width. I need to keep the width of this div according to its content ("whiteboardContent" div in the example), without growing.
Notes:
- html, body and main definitions are used in some other elements the page, better to keep them as they are.
- if possible, "#whiteboard" should cover all window. In the real case, some other divs will appear at this level, brothers of this div, in rows and placed at the left of this div. "whiteboard" is the one that must grow to fill all available space.
- It is a plus if "whiteboardPanel" and the buttons could appear centered horizontally, not touching the left side of the window.
- Solutions in plain html, css and javascript are preferable to other ones based external libs as jQuery.
- I known there are several similar questions but not yet found any one with an applicable solution.