Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change glyph height without changing the font-size?

Issue

for text elements that are adjacent to icon elements, the glyph height is not aligned with the icon height. the text elements are styled by CSS with font-size: 20px; and have consistent width for all their instances.

here's an illustration:

font problem

for the above case, the text should have the same height as the icon.

Motivation

finding a way to make the letters a bit taller to take up the available vertical space, while keeping the font-size as is. how to do that?

What have I tried?

to increase the font-size a bit, but came to conclusion i'll have to compromise for a smaller icon if I can't increase the letter height, thus the issue.

like image 289
Leron_says_get_back_Monica Avatar asked Jun 13 '12 07:06

Leron_says_get_back_Monica


People also ask

Does line height affect font size?

While there is no perfect line height, a good rule of thumb is to set it at approximately 150% of the font size. Top: When the line height is too tight, it undermines the horizontal reading flow and increases doubling.

How do you change text height in Illustrator?

You can also place your cursor in the text and press Control+A (Windows) or Command+A (macOS) to select it. Use the Properties panel on the right to change the font, style, and size.

How do I change the font height in HTML?

In HTML, you can change the size of text with the <font> tag using the size attribute. The size attribute specifies how large a font will be displayed in either relative or absolute terms. Close the <font> tag with </font> to return to a normal text size.


2 Answers

You can do it with css3 property Scale: (demo on dabblet.com)
enter image description here

HTML markup:

<span class="lower">lower size</span>
<span>normal size</span>
<span class="taller">taller size</span>

CSS:

span {
    font-size: 20px;
    display: inline-block;
}

span.lower{ transform: scaleY(0.9); }
span.taller { transform: scaleY(1.1); }

Also, you can try to set various values of vertical-align for images in your case: sub, super, bottom, top, middle. This may help to solve your problem from another point.

like image 132
Vladimir Starkov Avatar answered Sep 28 '22 16:09

Vladimir Starkov


Try adding line-height: 20px; it will only increase the space between lines. It should help you match the element height.

And considering your calendar icon and text, add vertical-align: middle; to the image.

Demo: http://jsfiddle.net/rBpKL/3/

like image 20
Dipak Avatar answered Sep 28 '22 18:09

Dipak