@font-face not working

2019-08-12 06:41发布

问题:

HI, I am pretty sure that I'm doing something wrong in that @font-face config, because it's not working in any browser, here is my css file:

@font-face {
     font-family: BodyFont;
     src: url('../ItcKabMed.eot');
     src: local('ITC Kabel'),
          url('../Kabel_ITC') format('opentype'),
          url('../Kabel_ITC') format('svg');
}
body {
  font-family: 'BodyFont';
  color: #797979;
  background: url("") repeat-x scroll 0 0 #d7d7d7;
  min-width: 1000px;
}

Some ideias, why my font is not showing up?!

回答1:

Like you can see here, to achieve crossbrowser success when using @font-face we need to use many font formats. So, convert your font to eot, ttf and svg and explicit use this formats:

@font-face {
    font-family: 'ITC Kabel';
    src: url('ITCKabel.eot');
    src: local('ITC Kabel'), 
         local('ITCKabel'), 
         url('ITCKabel.ttf') format('truetype'),
         url('ITCKabel.svg#font') format('svg'); 
}


回答2:

Are you sure you didn't forget the file extensions from your font paths?



标签: css font-face