I have a layout with an unordered list followed by an input element. I would like the layout to be one continuous row, where the input would be right after item 5. It would also determine if the minimum width of the input would allow it to go right after item 5, or if it needs to go on the next line of the row.
I could obviously achieve this by putting the input in the ul, and I could also change the ul to be a bunch of divs, but all of this takes away from the semantics. How would I achieve what I want with Flexbox?
div {
display: flex;
width: 160px;
flex-wrap: wrap;
}
ul {
list-style: none;
display: flex;
margin: 0;
padding: 0;
flex-wrap: wrap;
}
li {
border: 1px solid gray;
padding: 2px;
}
input {
min-width: 40px;
}
<div>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
<input>
</div>