I have a flexbox which wraps horizontally, inside an absolutely positioned div. The flexbox displays correctly, but its offsetWidth is based on the width of the widest column, rather than the entire contents.
This doesn't happen if the containing div has position: relative.
Is there a way to make this setup return the correct width, just with css? The group needs to be positioned on the right, and this issue means it's not getting placed correctly. I'm also using the width for some other operations.
Browsers: I'm seeing this on Chrome 46 and FF Dev Edition 43. IE11 displays correctly.
I'm currently working around this with javascript but that isn't ideal, it constrains the flexbox's behaviour in ways I'd rather it didn't.
jsfiddle here: https://jsfiddle.net/jonfagence/2qtkandt/8/ - showing the contents badly positioned.
div {
position: absolute;
right: 1em;
}
ul {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 3em;
}
li {
display: block;
padding: 0 10px;
}
li.double-height {
height: 3em;
font-size: 2em;
}
<div>
<ul>
<li>Value 1</li>
<li>Value 2</li>
<li class="double-height">Value 3</li>
<li>Value 4</li>
<li>Value 5</li>
</ul>
</div>
Don't think it's the same issue as this one (the flexbox displays correctly, for one thing), but possibly related: Absolutely positioned flexbox doesn't expand to fit contents