A
A
Alexander2019-11-21 14:58:37
css
Alexander, 2019-11-21 14:58:37

How to vertically align a string to lowercase letters?

I'm trying to figure out how do I make a box as small as a letter (1ex) and with a line inside that would be perfectly aligned within it, lettered in lower case?
An example of non-working alignment: https://jsfiddle.net/LordGuard/x2mfd01g/4/
It turns out like this:
5dd679aa99dd9385137234.png
And it should be like this:
5dd679b831b31040751813.png
It seems like it comes to mind to experiment with line-height and everything is displayed correctly - https://jsfiddle.net/LordGuard /x2mfd01g/7/ , but if you change the font size, the alignment breaks again (for example, with font-size: 12px), that is, this method does not work universally for any font size and requires the selection of a certain spherical number in a vacuum for each font.
If you put a line block with a height of 1ex next to a line, it aligns perfectly with the lowercase letters of this line, but so far I have not been able to figure out how to enter these lowercase letters in such a block.
5dd67d77142f6027182508.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NaN, 2019-11-21
@KornevaViktoria

Like that ?

X
xmoonlight, 2019-11-21
@xmoonlight

First you need to make a vertical rhythm on the page ( example ).
And only then - to align.
Check it out: fittextjs.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question