Font-face komandası
@font-face komandası istifadəçiyə
faylda saxlanılan mənbəyi olan şrifti
təyin etməyə imkan verir. Bu şrift daha sonra
font-family xüsusiyyəti ilə qoşula bilər.
Sintaksis
@font-face {
şriftin adı;
şriftin axtarış mənbəyi;
}
Nümunə
Gəlin lokal kompüterimizdə bir şrift tapaq:
<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ümunə
İndi isə şriftin axtarışı üçün uzaq serverin ünvanını göstərək:
<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;
}
: