font-family property of this element. Such a switch of fonts can also affect the size of the element, if they depend on the size of the text in it.data:uri so that the font is displayed immediately, along with the page.eot are the lightest, but only IE is supported.ttf and svg are heavy, sometimes - of course, it depends on the font - occupying twice the space than eot and woff . In my situation, I chose woff , this format is supported by most browsers of our visitors.woff do not understand, so the alternatives for them are indicated.woff , they need eot . At the same time, IE8 does not understand files in data:uri heavier than 32KB , and the older versions do not perceive any, so in a separate style file for them you can simply specify links to font files. To prevent these browsers from loading unnecessary ones, the connection of the font in woff and in other formats is highlighted in a separate style file and separated by a conditional comment.svg fonts look better than others , but it seems to me that this is a matter of taste. The font in this format is compressed better than others with gzip , but is not supported by Firefox and IE. <!-- --> <!--[if lte IE 8]> <link rel="stylesheet" href="fonts_ie.css" media="all"> <![endif]--> <!--[if gt IE 8]><!--> <link rel="stylesheet" href="fonts.css" media="all"> <!--<![endif]--> <link rel="stylesheet" href="main.css" media="all"> /* fonts_ie.css */ @font-face { font-family: 'PT Sans Narrow'; font-style: italic; font-weight: bold; src: url('PTS76F_W.eot'); } /* fonts.css */ @font-face { font-family: 'PT Sans Narrow'; font-style: italic; font-weight: bold; font-variant: normal; src: url('data:application/x-font-woff;base64,d09GRgABAAAA...aCw0AAA==') format('woff'), url('PTN77F_W.svg#PTSans-NarrowBold') format('svg'), url('PTN77F_W.ttf') format('truetype'); } /* main.css */ body { font-family: 'PT Sans Narrow', 'Arial Narrow', sans-serif; font-style: italic; } woff fonts, systematically losing users browsers, the most common of which at the moment is IE8.woff , but who will have to download them. Here the number of visitors with such browsers and the productivity of their visits already plays a role. In my situation it turned out that it is better to eliminate the VOSH.data:uri .Source: https://habr.com/ru/post/180615/
All Articles