Struggling to align a span vertically in the middle with a different font size than its table cell. The goal is to have the following layout:
| |
| Measurement (font-size: 100%) unit (font-size: 70%)|
| |
This is how my markup looks:
<td class="value">Performance <span class="unit">kW</span></td>
The unit
span is aligned right within the cell using float:right
, while the entire cell has vertical-align:middle
styling. However, this combination does not produce the desired result. It appears the floating style causes the unit
span to align at the top where the text "Measurement" begins.
Removing the floating style from the second span in the provided reference demonstrates the effect.
Is there a simple way to achieve the desired layout without adding more markup or using floating styles? Attempts with relative positioning did not seem to allow for proper vertical centering of the unit
span.
Thank you!