I want to align the baselines of a and c.
#grid{ display:grid; grid-template-columns: 1fr 1fr; align-items: baseline; } #a{ grid-row: 1 / span 2; grid-column: 1; padding: 8px; background: red; } #b{ grid-row: 1; grid-column: 2; background: yellow; } #c{ grid-row: 2; grid-column: 2; background: blue; }
aaaaabbbbbccccc
I tried setting the outer grid to a single line and wrapping b and c in a div with the inline-whatever attribute, but a still always aligns with b instead of c.
#grid{ display:grid; grid-template-columns: 1fr 1fr; align-items: baseline; } #a{ grid-row: 1; grid-column: 1; padding:8px; background:red; } #d{ display:inline-block; grid-row: 1; grid-column: 2; } #b{ background:yellow; } #c{ background: blue }
aaaaabbbbbccccc
How to align a and c with the baseline?
Since last baseline is relatively new (I'm using Electron 19 which doesn't support it), I'm looking for alternatives. Referring to this SO post about flex, it turns out I need to wrap the inline-block in another container.
I believe you want to declare align-items: last baseline.
"Can I Use align-items: last baseline?" shows a global support rate of 85%.
For specification terminology, see Flex Container Baseline.