3

I am using a purchase font (Museo Sans) for a custom font in an app I am working on. The files given to me when I purchased it contain web font files for different weights: MuseoSans100Regular, MuseoSans300Regular, etc. Is there a way in @font-face to specify the files to use for the different weights so that I can do this:

font-family: MuseoSans;
font-weight: 300;

Rather than this:

font-family: MuseoSans300;
nicknisi
  • 495
  • 1
  • 4
  • 16

1 Answers1

7

Yes, you have to specify which file is for which font-weight in two different @font-face definitions:

@font-face {
    font-family: 'MuseoSans';
    src: url('../font/museo_sans_100.woff');
    font-weight: 100;
    font-style: normal;
}
@font-face {
    font-family: 'MuseoSans';
    src: url('../font/museo_sans_300.woff');
    font-weight: 300;
    font-style: normal;
}

h1, p {
    font-family: MuseoSans;
}

h1 {
    font-weight: 300; /* uses museo_sans_300.woff */
}

p {
    font-weight: 100; /* uses museo_sans_100.woff*/
}
Nikola K.
  • 7,093
  • 13
  • 31
  • 39
feeela
  • 29,399
  • 7
  • 59
  • 71
  • I just found out that this question was already answered here on SO: http://stackoverflow.com/questions/2436749/how-to-define-bold-italic-using-font-face – feeela Sep 26 '12 at 09:30