How to pack a custom TrueType font from a website so that browsers display it?

I am developing a site for someone, but they want (insist) that the name be in a non-standard font. (The client is always right.) I have a TrueType font (.ttf), but how can I link it to a website so that it uses it?

I tried to put it in the Images folder and tried to access it with a list of styles:

font-family:URL(Images/Arial_Rounded_MT_Bold.ttf)

But that did not work. How to include a custom font in a way that will be displayed?

In case this is useful, this is an ASP.NET 2.0 site.

+3
source share
5 answers

. @font-face, . Lance, - , .

. Web Open Font Format (WOFF) - . , . .

, , () .

font-family: "Arial Rounded MT Bold", "Times New Roman", Serif
+5

:

+3

TrueType Embedded OpenType ( !), :

  • Arial_Rounded_MT_Bold.ttf
  • Arial_Rounded_MT_Bold.eot

, CSS :

@font-face {
  font-family: 'Arial Rounded Bold';
  src: url('Arial_Rounded_MT_Bold.eot');
}
@font-face {
  font-family: 'Arial Rounded Bold';
  src: url('Arial_Rounded_MT_Bold.ttf') format('truetype');
}
h1.title {
  font-family: 'Arial Rounded Bold', serif;
}

Internet Explorer EOT , @font-face format. .

!

+2

There are many font distribution events along with websites, but, as a rule, at the experimental stage, it will not work for the vast majority of browsers used. In a few years you will be able to do this, but for now you will have to use an image or sIFR .

+1
source

Source: https://habr.com/ru/post/1722042/


All Articles