Komanda font-face
Komanda @font-face omogućava da se definiše
korisnički font čiji se izvorni fajl
čuva na fajl sistemu. Ovaj font se onda može
povezati pomoću svojstva font-family.
Sintaksa
@font-face {
naziv fonta;
izvor za pretragu fonta;
}
Primer
Hajde da pronađemo font na našem lokalnom računaru:
<body>
This is Montserrat SemiBold.
</body>
@font-face {
font-family: "Montserrat SemiBold";
src: local("Montserrat SemiBold");
}
body {
font-family: "Montserrat SemiBold";
}
#elem {
animation: anim 3s infinite;
border: 1px solid black;
width: 50px;
height: 50px;
}
:
Primer
A sada da navedemo adresu udaljenog servera za pretragu fonta:
<body>
This is Bitstream Vera Serif Bold.
</body>
@font-face {
font-family: "Bitstream Vera Serif Bold";
src: url("https://mdn.github.io/css-examples/web-fonts/VeraSeBd.ttf");
}
body {
font-family: "Bitstream Vera Serif Bold", serif;
}
#elem {
animation: anim 3s infinite;
border: 1px solid black;
width: 50px;
height: 50px;
}
: