Is there a way to apply a CSS style (at parent and/or child level) to indicate that the child elements are to share the same flex column width? If not, I presume Javascript can accomplish it.
For example, on the below form, I want the three div controls in the first column to have the same width (so that the second columns line up vertically), but I don't want to set a width absolutely or relative to their parent -- rather, I want the maximum of the flex widths to be used.
Associated html (for fields only):
<div class="form">
<div class="item-row">
<div class="item-row-label">
Last Name
</div>
<div class="item-row-value">
<input />
</div>
</div>
<div class="item-row">
<div class="item-row-label">
First Name
</div>
<div class="item-row-value">
<input />
</div>
</div>
<div class="item-row">
<div class="item-row-label">
State
</div>
<div class="item-row-value">
<input />
</div>
</div>
</div>
Associated CSS (for fields only):
.item-row {
display: flex;
padding: 2.5px;
align-items: center;
}
.item-row .item-row-label {
margin-right: 10px;
}
.item-row .item-row-value {
flex: 1;
}
.item-row .item-row-value input {
border-radius: 5px;
border: 0;
background-color: lightgray;
margin: 0;
width: 100%;
padding: 3px 10px;
outline: none;
}
