I have a certain scenario like follows:
You have three inline-elements, two are the same essentially, but the one in the middle is not and its width will always be unknown.
You want either two things:
- All three elements are inline on the same row
- If the width is two small, all three elements are stacked on top of each other
With display: inline-element, it will collapse as needed, meaning at a certain width two elements will be on top while one is on bottom. This isn't any of the desired conditions.
.div-a {
background-color: red;
}
.div-b {
background-color: blue;
}
div {
display: inline-block;
font-size: 4em;
}
<div class="div-a">
L
</div>
<div class="div-b">
Mid
</div>
<div class="div-a">
R
</div>
How can we make sure that either all blocks are stacked, or they are all inline? Remember the middle element will always be unknown width.
EDIT: Don't know why this was marked as duplicate, as I didn't even ask about media query resizing, that's just one of the solutions.