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

Brady Borkowski
Brady Borkowski
7,495 Points

Why are there two "src" imports rather than only one?

I was first confused as to why there were 2 "src" imports instead of all of the fonts having their own, but then I realized that the second src is importing multiple different fonts.

I'm confused now as to why the first font needs its own src while the rest only need to share one. Is it not possible to have accomplished the same thing while only typing "src" one time, or is it up to personal preference?

1 Answer

Christopher De Lette
PLUS
Christopher De Lette
Courses Plus Student 7,139 Points

The reason for the second src property in the @font-face construct is to fix a "bug" in old versions of IE prior to 8 I believe. You most certainly can omit this src property and use one for the type of web font chosen although it is still used in practice. So you could have

@font-face {
   font-family: 'Name you choose that distinguishes font from others used';
     src: url('font location') format('font type'),
            url('font location') format('font format type'),
          */rinse...repeat for as many format type as you have chosen for that font*/
}

Hope this clears things up a bit. Take care and Happy Coding!

Brady Borkowski
Brady Borkowski
7,495 Points

Thank you so much! Definitely cleared it up for me :)