The labels in the left column of the form are initially sized correctly, but shrink when there is not enough room. However, there's a discrepancy in label size between rows with 2 items and rows with 3 items.
body {
font-family: Arial;
font-size: 12px;
}
.input1 {
flex: 1;
}
.row {
flex-direction: row;
display: flex;
flex: 1;
align-items: center;
}
span {
width: 120px;
}
.main {
width: 200px;
}
.group {
border: 1px solid rgba(0,0,0,.25);
}
.shrinkSameAmount {
width: 52px;
min-width: 52px;
}
<p>Full Size:</p>
<div class="group">
<div class="row"><span>ID</span><input class="input1"/></div>
<div class="row"><span>ID</span><input class="input1"/><button>X</button></div>
</div>
<p>Reduced Size:</p>
<div class="main group">
<div class="row"><span>ID</span><input class="input1"/></div>
<div class="row"><span>ID</span><input class="input1"/><button>X</button></div>
</div>
<p>What I want when reduced:</p>
<div class="main group">
<div class="row"><span class="shrinkSameAmount">ID</span><input class="input1"/></div>
<div class="row"><span class="shrinkSameAmount">ID</span><input class="input1"/><button>X</button></div>
</div>
Is it possible to maintain consistent label widths regardless of viewport size?