I have a form with the bottom-aligned behaviour, I need all the inputs in a row to be aligned to the bottom and be on one line visually. The reason for this is that the label can include instructions or not include them. The controls can be of different hight and type (text input, select, radio group, checkbox group, fieldset). The form that is used is antd Form component that is build using flex, that's why the markup of input's and label's wrappers cannot be changed. Also the each ant class have it's own styles:
I use the align-self: end;to make the control div to be aligned to the bottom. It works fine when I have one-line error
But it doesn't look good when I have multi-line error.
Can anyone suggest how to align the controls properly using the CSS (maybe grid...)?
The desired result (the right input is located one the same line as the left one):

Thank you!
https://codepen.io/Ke1sy/pen/gOELweY
HTML:
<div class="container">
<div class="ant-form ant-form-vertical ant-form-align-fields-bottom">
<div class="ant-row">
<div class="ant-col ant-col-xs-24 ant-col-sm-12 ant-col-lg-8">
<div class="ant-form-item ant-form-item-with-help">
<div class="ant-row ant-form-item-row">
<div class="ant-col ant-form-item-label">
<div>Label </div>
<div style="color: grey">Long instructionsLong instructionsLong instructionsLong </div>
</div>
<div class="ant-col ant-form-item-control">
<div class="input"><input type="text"></div>
<div class="error">Long error Long error Long errorLong errorLong errorLong errorLong errorLong error</div>
</div>
</div>
</div>
</div>
<div class="ant-col ant-col-xs-24 ant-col-sm-12 ant-col-lg-8">
<div class="ant-form-item ant-form-item-with-help">
<div class="ant-row ant-form-item-row">
<div class="ant-col ant-form-item-label">Label</div>
<div class="ant-col ant-form-item-control control">
<div class="input"><input type="text"></div>
<div class="error">Short instructions</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
The styles that are applied over the antd styles:
body {
margin: 0;
}
.container {
max-width: 900px;
}
.error {
color: red;
padding: 5px 0;
}
.ant-form-item {
border: 5px solid rgb(111, 41, 97);
}
.ant-form-item-label {
background: orange;
width: 100%;
}
.ant-form-item-control {
background: #eee;
padding: 10px;
width: 100%;
}
.ant-form-align-fields-bottom {
.ant-form-item {
height: 100%;
.ant-form-item-row {
height: 100%;
display: grid;
.ant-form-item-control {
align-self: end;
}
}
}
}
Antd css file to include: https://cdnjs.cloudflare.com/ajax/libs/antd/4.24.15/antd.compact.min.css
Depending on the rest of your layout or other requirements you could use css-grid in order to get your desired layout.
If you remove the divs around each input and label, you could just use a grid, which flows in the column direction. The height of the rows will be defined by the largest item and therefore affect the other control-divs as well.