Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Basics (2014) Understanding Values and Units Fonts and Line Height Review

Bei Zhang
PLUS
Bei Zhang
Courses Plus Student 7,113 Points

what property lets us specify the font for an element? i actually cann't understand. i think font has several styles.

what property lets us specify the font for an element? i actually cann't understand the question. i think font has several styles.

Antonio De Rose
Antonio De Rose
20,884 Points

The font-family property can hold several font names as a "fallback" system. If the browser does not support the first font, it tries the next font.

p {
    font-family: "Times New Roman", Georgia, Serif;
}

3 Answers

Evan Agee
Evan Agee
13,088 Points

the "font" css property is a shorthand for several font-related properties. The one you want is "font-family" which only allows you to specify the typeface you want to use.

Bei Zhang
Bei Zhang
Courses Plus Student 7,113 Points

thx :) my first language is Chinese. i am confused about the question. why font-size/font-style can not specify for an element? the question dose not mention typeface....

Arthur Wells
Arthur Wells
9,520 Points

Yes, if you are trying to specify the font-family, then you have it right. You can also style the font-size (ie 'font-size = 2em;'), font-weight (ie 'font-weight = bold;'), etc. Yes, font has several aspects of style that can set. There is also a shorthand method, with which you use only 'font =' and specify several of the style aspects. Hope that is of some help.

Bei Zhang
Bei Zhang
Courses Plus Student 7,113 Points

thx :) you mean font-size/font-style/font-weight can also specify the font for an element? my first language is Chinese. i met this question in the quiz. i just confused.

Arthur Wells
Arthur Wells
9,520 Points

'font' alone can be used to describe all styles of a font at once, such as size, weight, family, if you use the shorthand method. But you can also style each of these individually by using font-size to style size, font-family to style the family such as Arial, sans serif, etc.