Stephan Pich
Stephan Pich

Reputation: 301

CSS import fonts from otf

guys, I'm having trouble with importing fonts from an otf file

main.css

@font-face {
    font-family: 'testfont';
    src: url('fonts/test.otf');
}

.fonttest {
    font-family: 'testfont';
}

main.html

<p class="fonttest">TESTtest</p>

But still when I try start the homepage it shows the standard font of html. When I use the inspector on my browser opera and chrome it says that the font was accepted

Upvotes: 10

Views: 23446

Answers (2)

You can implement your OTF font using @font-face like:

@font-face {
    font-family: testfont;
    src: url("fonts/test.otf") format("opentype");
}

@font-face {
    font-family: testfont;
    font-weight: bold;
    src: url("fonts/test.otf") format("opentype");
}

Upvotes: 0

Dev.aaron
Dev.aaron

Reputation: 296

use this;

@font-face {
    font-family: testfont;
    src: url("fonts/test.otf") format("opentype");
}

Upvotes: 20

Related Questions