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) Enhancing the Design With CSS Web Fonts with @font-face

The first to font imports had "src" in front but the last 2 imports did not. Why?

This tutorial imported fonts in CSS with total 4 links. The first 2 links had the "src" before the link. The second two did not. Does anyone know why?

2 Answers

Jeff Jacobson-Swartfager
Jeff Jacobson-Swartfager
15,419 Points

Absolutely! If you check out the @font-face declaration again, you'll notice that there are really only three declarations within in it: a name for the font to use in the rest of the stylesheet (Abolition Regular), a url for just the eot (for IE 9+), and a font stack (for older versions of IE and all other browsers). The font stack is broken up with commas, not semicolons.

@font-face {
  /* Here's the name that will be used in the rest of the stylesheet, checkout about 2:10 in the vid */
  font-family: 'Abolition Regular';

  /* Here's one for just the eot, checkout about 3:14 in the vid */
  src: url('../fonts/abolition-regular-webfont.eot');

  /* And, here's the full font stack, checkout about  3:30 in the vid */
  src: url('../fonts/abolition-regular-webfont.eot?#iefix') format('embedded-opentype'),                                                                                                                  
       url('../fonts/abolition-regular-webfont.woff') format('woff'),                                                                                                                                     
       url('../fonts/abolition-regular-webfont.ttf') format('truetype');                                                                                                                                  
}    

ah I see.. that means I need to step away from the screen. This platform is addictive. Thank you so much.

Lefora Williams
Lefora Williams
2,486 Points

Thanks for this explanation! I was trying to figure out what was going on with there!