I'm trying to have two items on one line, then have a third item on the next line. I stumbled upon this answer, but the answer didn't work for an input type="text"
. The input
is on its own line, which results in each element having its own line.
Why doesn't it work, and how can I have the first two elements on one line, and the third element on the second line?
#wrapper {
height: 70px;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
#wrapper > * {
flex: 1 0 50%;
}
#wrapper > *:last-child {
flex: 0 1 100%;
}
<div id="wrapper" style="background-color: rgb(144, 248, 144);">
<label id="first">First Text</label>
<input type="text" id="second">
<span id="third">Third Text</span>
</div>