Skip to content

24 ways to impress your friends

Vote down?

Andy Beeching

Could you take this a step further with JS, and onload, or domContentReady (etc..), detect what font-family has been applied by the browser and set a class on the body element if font specific styles were needed to tweak the typography? That is, you’d probably optimise the type rules for your first choice font, but if that is unavailable and the fall-back fonts are applied, then details such as leading, size etc might require a touch of refinement (in the form of additional CSS rules) that you don’t want to apply by default. Trying to read the style object it seems that it only returns the original rule, as opposed to the applied one…