Font-face'i käsk
Käsk @font-face võimaldab määrata
kasutajaliidese fondi, mille lähtefail
on salvestatud faili. Seda fonti saab
seejärel ühendada kasutades omadust font-family.
Süntaks
@font-face {
fondi nimi;
fondi allika otsing;
}
Näide
Otsime oma lokaalsest arvutist fondi:
<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;
}
:
Näide
Ja nüüd määrame fondi otsimiseks kaugserveri aadressi:
<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;
}
: