0

I need to set a font family in my web page with thte @font-face, but I can't make it work propertly: This is the content of my css file

@font-face {
    font-family: knockout;
    src: url('../fonts/knockoutHTF27.ttf');
}

body {
    font-width: normal;
    font-size: 20px;
    font-family: knockout !important;
    color: #223041;
    text-align: center;
}

I've tried the same code in two diferent computers and it works pefercty in one of them but doesn't work in the other. What could be wrong?

Matija Mrkaic
  • 1,817
  • 21
  • 29
Lorena
  • 193
  • 7
  • 18

3 Answers3

1

You should try with full embedding, with all the quotation marks. It clears possible malfunctions on different browsers/OS.

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff') format('woff'), /* Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

Then, use it like this:

body {
    font-family: 'MyWebFont', Fallback, sans-serif;
}

As mentioned in a previous answer, if needed, you can use http://www.fontsquirrel.com/ or one of other font-face generator services on the web, to get all needed font formats.

Matija Mrkaic
  • 1,817
  • 21
  • 29
0

Try after removing ''

src: url(../fonts/knockoutHTF27.ttf);
Arunkumar
  • 5,150
  • 4
  • 28
  • 40
0

You must use other font file format for different browesers not only .ttf, .woff, .eot. And check your path

Pete
  • 57,112
  • 28
  • 117
  • 166
Anon
  • 2,854
  • 14
  • 18