How can I force line height in CSS, in such way that no big letters will stretch the line height. Instead, they should clip under the above line, or even merge with the above line.
CSS line-height seems to work like MS Word’s “at least” line height option by default. I want to make it work like MS Word’s “exactly” option.
For example:
There, the lines aren’t the same height, because one line has some bigger letters in it. I want all lines to be the same height regardless.
That’s the case for the main, non bold, text in your example.
So in the bold text, you’ll still have 8.5px above the font-size, which causes the issue.
You can prevent it by setting a line-height smaller than the font-size ( check this demo ). As it’s an inline element, and there’s no
overflow:hidden;it will still be enterely visible, but it won’t add any pixel to the rest of the text’s line height.As far as i know, it’s not possible to “stretch” the letters, unless you use some CSS3 properties like
transform:scale(value)etc.Reference
Code:
CSS: