5

After exploring typography more I've learnt the different between a typeface and a font :)

I'd like to know how I can call the fonts 'Arial Black' or 'Arial Narrow' within CSS? The font-family setting doesn't do it. Is this what the font-weight setting is for?

0

3 Answers 3

5

At least as far as CSS is concerned, these are different font families.

Note that if the font name includes spaces, you need to wrap it in quotes:

font-family: Arial;
font-family: "Arial Black";
font-family: "Arial Narrow";

You can choose the bold or italic fonts in a family like this:

font-family: Arial;
font-weight: bold;
font-style: italic;

If a family doesn't contain bold/italic/bold-italic fonts, they'll be simulated by distorting the base font. This should be avoided, as it doesn't usually look good.

2
  • Yep. Sadly, the W3C wasn't flush with typography folks when these things were built into CSS, so it is an awkward situation.
    – DA01
    Commented Nov 23, 2011 at 19:50
  • Browser's rendering of different styles is getting better with time though. Eventually we may be able to load 1 font file and use built in browser rendering for the other fonts which can save on load time Commented Jan 27, 2016 at 18:30
1

You can put "Arial Black" or "Arial Narrow" in your font stack (put them in front if you want them to be the default), but if the user doesn't have them installed their browser will substitute the first font they have installed.

You can force the font on users using @font-face,but that takes some configuring. A good place to read up on how to that is http://www.fontsquirrel.com.

1

The font-family property specifies the font for an element. It also requires the font to be installed on the end users operating system. This is why font stacks are used with multiple fallbacks all the way down to serif and sans-serif. font-style specifies the style of the font such as italic or oblique. font-weight specifies the weight bold, normal, lighter, heavier or it can be expressed in numeric value.

body {
font-family: helvetica, arial, sans-serif;
font-weight: bold;
font-style: italic;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.