Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fonts inside a font family display different in size

Whenever I come at the point in my designs to select the font, this common problem occurs (common for every designer) ,

For example we set the font family and font size for a paragraph as follows,

p {
    font-family: 'Source Sans Pro', Arial, Verdana, sans-serif;
    font-size: 13px;
}

In CSS (as everyone knows) when the first font in the font family is not present, it selects the second font, and if the second is not present it goes for the third one and so on.

The problem is that Arial is bigger than 'Source Sans Pro' at 13 px, and Verdana is bigger than Arial at 13 px.

Look at this image:
enter image description here

This is the problem every designer face every single time they think the font family for a design.
I wish there was some CSS method or hack by which we tell the browser to take the 'Source Sans Pro' at 13px, but if its not present than don't take Arial at 13px, instead take Arial at 12px, and if even Arial is not present than take Verdana at 11px.
e.g. font-family-size: 'Source Sans Pro' 13px, Arial 12px, Verdana 11px; (this rule isn't there in CSS, its just my wish)

Summary: We can assign a single size for the whole font family (font family which contains more than one fonts), now in practical every font size display different (smaller or bigger) than other fonts in the same font family.

like image 505
Bangash Avatar asked Mar 26 '14 16:03

Bangash


People also ask

Why are my fonts different sizes?

Both the x-height as well as the cap height of a font affect its legibility, and will make different typefaces look larger or smaller at the same point size. When designers first try out different fonts, they usually look for a size that looks and works best for the demographics and requirements of the design at hand.

What is the difference between font size and font-family?

And a “font family” represents a collection of related fonts, such as bold and italic variations of the same “typeface” or “font”. In summary, in common terminology, typeface (aka font) means the design, font means the file containing the typeface, and font-family means collection of related fonts.

Why do fonts look different on different monitors?

Fonts are stored in files on the computer and they are called by their name. If two fonts use the same name the computer will overwrite the old one. If two different custom fonts use the same name and each computer has a different one installed, the fonts will display according to how they are installed.

Is it reasonable to have two generic fonts in a font-family rule?

Web authors should always add at least one generic family in a font-family list, since there's no guarantee that a specific font is installed on the computer or can be downloaded using a @font-face at-rule.


1 Answers

What you are looking for is the font-size-adjust property — a nearly perfect solution to this problem. Of course, browser support is terrible: it only works on Firefox.

Here's an example (open in Firefox): http://jsfiddle.net/zL6vL/1/

like image 200
Nelson Menezes Avatar answered Sep 27 '22 22:09

Nelson Menezes