A question I posted here a while ago lead me to fiddling around with flexbox a bit, at first it seemed like the solution to what I needed but that is no longer the case since the content width is unknown.
I made this FIDDLE that shows what I mean. I am trying to get the YELLOW div to expand itself, to increase it's width property when multiple items are present. The display of the items is proper in that example, they are docked to the right side, in a direction left-to-right, but I cannot seem to get the yellow div to expand based on the content.
function addMore() {
var element = document.createElement('div');
element.classList.add("flexitem");
document.getElementsByClassName('flexcontainer')[0].appendChild(element);
}
.flexcontainer {
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column wrap;
flex-flow: column wrap;
-webkit-align-content: flex-end;
align-content: flex-end;
height: 100%;
}
#rightDock {
position: fixed;
right: 0px;
top: 0px;
background-color: yellow;
width: auto;
min-width: 10px;
height: 100%;
}
.flexitem {
width: 150px;
height: 30px;
margin-right: 15px;
margin-left: 15px;
margin-top: 20px;
background-color: red;
}
<div id="rightDock">
<div class="flexcontainer">
<div class="flexitem"></div>
<div class="flexitem"></div>
<div class="flexitem"></div>
</div>
</div>
<button onclick="addMore();"style="margin: 30px 30px; height: 60px; width:200px">
Add more divs to flexbox
</button>