I have a set of radio buttons arranged like this:
https://i.sstatic.net/l4uhp.png
I want to utilize flexbox to display them horizontally when there is sufficient space, similar to this:
https://i.sstatic.net/IGUAc.png
However, the current setup uses a min-width
media query for layout breaking, which can lead to text overflow:
.radio-btn-label {
width: 100%;
height: 40px;
}
@media only screen and (min-width: 900px) {
.radio-btn-group {
display: flex;
}
https://i.sstatic.net/Z5J2t.png
Is there a way to add constraints on either the individual flex items or on the container itself to prevent text overflow in the flex layout?
Currently, the HTML structure looks like this:
<div>
<label class="radio-btn-label">
<input type="radio">
<div class="label-text">Foo</div>
</label>
</div>
The .label-text
class has styling with borders and background for the list element. This allows the use of
input[type='radio']:checked + .label-text
selector for different styling when the button is selected.