Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set font-size accordingly to font availability?

Tags:

css

font-size

Is it possible to set a different font-size according to font availability?

Currently my problem is that Verdana is too big, and if the user don't have Verdana installed, I will end up with a very small font-size

Is there is any way to set a font (Verdana in my case) to 13px and if the user don't have that font installed, try with another font (Arial for example) but with bigger font-size?

Notes:

  • Preferably CSS only
  • CSS hacks allowed
like image 232
ajax333221 Avatar asked Dec 16 '11 22:12

ajax333221


People also ask

How do I automatically adjust font size in CSS?

Syntax: font-size-adjust: number|none|initial|inherit; Below are the examples that illustrates the use of font-size-adjust property.

What is the rule for font size?

Optimal font sizes for desktop There are no exact rules for font sizing, but there are some generally good practices to think about when designing for desktop: Body text - Font sizes should be around 16px to 18px for legibility (or 1.6rem to 1.8rem using our sizing rules mentioned above).

Can we give font size in percentage?

font-size can accept keywords, length units, or percentages as values. It's important to note however that when it's declared as part of the font shorthand property, font-size is a mandatory value.


1 Answers

As was answered just a minute ago by someone else (but already deleted?), you could use Font Detector Javascript solution:

http://jsfiddle.net/FHnJw/1

like image 112
ptriek Avatar answered Sep 20 '22 12:09

ptriek