|
3 | 3 | ═══════════════════════════════════════════════════════════════════════════ */ |
4 | 4 |
|
5 | 5 | /* ── Side-by-side field alignment ──────────────────────────────────────── |
6 | | - When two or more fields sit in a .row.fields-aligned-row, columns |
7 | | - stretch to equal height (the default flex behaviour). Each .mb-3 |
8 | | - wrapper becomes a flex column so the label area grows evenly and |
9 | | - the input sits at a consistent vertical position regardless of |
10 | | - label length, help-text presence, or wrapped text. */ |
| 6 | + When two or more fields sit in a .row.fields-aligned-row, every column |
| 7 | + becomes a flex column so .mb-3 can stretch to fill it. The input/select |
| 8 | + uses margin-top:auto to push itself to the bottom of the label area, |
| 9 | + keeping inputs horizontally aligned regardless of label wrapping. */ |
| 10 | + |
| 11 | +/* 1. Make each column a flex column so .mb-3 can stretch */ |
| 12 | +.row.fields-aligned-row > [class*="col-"], |
| 13 | +.row.fields-aligned-row > .field-wrapper { |
| 14 | + display: flex; |
| 15 | + flex-direction: column; |
| 16 | +} |
11 | 17 |
|
| 18 | +/* 2. .mb-3 fills the column and is itself a flex column */ |
12 | 19 | .row.fields-aligned-row > [class*="col-"] > .mb-3, |
13 | 20 | .row.fields-aligned-row > .field-wrapper > .mb-3 { |
14 | 21 | display: flex; |
15 | 22 | flex-direction: column; |
16 | | - height: 100%; |
| 23 | + flex: 1 1 auto; |
17 | 24 | } |
| 25 | + |
| 26 | +/* 3. Labels stay at their natural size */ |
18 | 27 | .row.fields-aligned-row > [class*="col-"] > .mb-3 > label, |
19 | 28 | .row.fields-aligned-row > .field-wrapper > .mb-3 > label { |
20 | 29 | flex-shrink: 0; |
21 | 30 | } |
| 31 | + |
| 32 | +/* 4. Push the input/select to the bottom of the label area */ |
22 | 33 | .row.fields-aligned-row > [class*="col-"] > .mb-3 > .form-control, |
23 | 34 | .row.fields-aligned-row > [class*="col-"] > .mb-3 > .form-select, |
24 | 35 | .row.fields-aligned-row > .field-wrapper > .mb-3 > .form-control, |
25 | 36 | .row.fields-aligned-row > .field-wrapper > .mb-3 > .form-select { |
26 | | - margin-top: auto; /* push the input to the bottom of the cell */ |
| 37 | + margin-top: auto; |
27 | 38 | } |
28 | | -/* Help text sits *after* the input and shouldn't shift it up */ |
| 39 | + |
| 40 | +/* 5. Help text sits after the input — reserve consistent space */ |
29 | 41 | .row.fields-aligned-row > [class*="col-"] > .mb-3 > .form-text, |
30 | 42 | .row.fields-aligned-row > .field-wrapper > .mb-3 > .form-text { |
31 | 43 | flex-shrink: 0; |
32 | | - min-height: 1.4em; /* reserve space even when empty for alignment */ |
| 44 | + min-height: 1.4em; |
33 | 45 | } |
34 | 46 |
|
35 | 47 | /* ── Consistent field spacing ────────────────────────────────────────── */ |
|
0 commit comments