I'm basically trying to get the baseline of the value to align with the baseline of the bottom unit instead of the first as it's happening in my code below.
I can get it to work if I ditch flexbox altogether but I need it for responsiveness.
The canonical advice seems to be to wrap flex items in inline-block
but, as you can see from that codepen, it doesn't seem to work for me.
Here's the codepen where I've been trying stuff: https://codepen.io/jskrt/pen/OJyXxyv
.value_and_unit {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: baseline;
}
.value {
line-height: 1;
font-size: 120px;
margin-right: 10px;
}
.unit_container {
display: flex;
flex-flow: column nowrap;
justify-content: flex-end;
align-items: center;
}
.divider {
width: 100%;
}
.inline-block {
display: inline-block;
}
<div class="value_and_unit">
<span class="value">
340
</span>
<div class="unit_container">
<span class="unit">
m
</span>
<hr class="divider" />
<span class="unit">
s
</span>
</div>
</div>