Is it possible to position items in a flexbox like this?
I've tried flex-flow: column wrap, but it'll require fixed height. Which isn't available for this case.
Any other way other than flexbox? Any idea or direction will be really appreciated.
I can use some javascript if required, but can't use any library. And I can't modify html.
Thanks.
Edit: Item #3 and #4 is supposed to be a sidebar with adjustable width.
Is this approach too bad if there are contents inside each item?
html:
<div id="parent">
<div class="some-class">Item 1</div>
<div class="some-other-class">item 2</div>
<div class="sidebar">item 3</div>
<div class="sidebar">item 4</div>
<div class="no-class">item 5</div>
<div class="else">item 6</div>
</div>
css:
#parent{
display: flex;
}
#main{
width: 70%;
}
#sidebar{
width: 30%;
}
js:
$(document).ready(function(){
$('<div>', {
id: 'main',
}).appendTo('#parent');
$('#parent').children().appendTo('#main');
$('<div>', {
id: 'sidebar',
}).appendTo('#parent');
$('#main .sidebar').appendTo('#sidebar');
});