Tuesday, February 4, 2014

Fonts

9 more days left till that 30 day mark!

Do you remember seeing this from yesterday?

font-family: Verdana, sans-serif;

Well if you don't, I tell you. I used it in my style sheet to declare what kind of font I want the text in the body to be. However, why are there two values (Verdana and sans-serif)? And why is one capitalized and the other not?

Well, a browser can only display a font that the viewer has installed on his/her computer. The multiple values for the font are to give you a bit more control over what your viewer sees. In our example, if the viewer does not have the Verdana font, then we tell the browser to choose a font available from the font family sans-serif. See, if you didn't have sans-serif following Verdana, then the browser would just use the default font. And, what is a font family?

A font family is a category of styles. There are five main ones:

Font familyExamples
serifTimes New RomanGeorgia
sans-serifArialTrebuchet
monospaceCourierCourier New
cursiveComic SansApple Chancery
fantasyImpactWestern

See, font families should be lowercase, but a specific font should start with a capital letter.

No comments:

Post a Comment