Vertical alignment of bottom sections with different text sizes
Inside a flexible border, how can the bottom edges of the text be vertically aligned in two different divs with two different font sizes?
Here is a very simple jsfiddle: http://jsfiddle.net/aegh74dr/1/
You will notice that the two divs in the flex box contain different font sizes. The attribute align-items
matters flex-end
, but the two different divs are not aligned at the bottom.
Thank!
source to share
You can use:
align-items: baseline;
Using a value such as a baseline allows you to align elements, such as aligning their original lines.
As Mozilla Developers Networks describes align-items: baseline;
:
The baselines (leading edge or trailing edge depending on the flex-direction property) of all flex items are aligned with each other. The flex item that takes up the most space, perpendicular to the layout axis, follows the flex-start rule. The baselines of all other elements are then aligned with the baseline of that element.
source to share