English 中文(简体)
@font-face src: local - How to use the local font if theuser have it?
原标题:@font-face src: local - How to use the local font if the user already has it?
最佳回答

如果你想首先检查当地档案:

@font-face {
font-family:  Green Sans Web ;
src:
    local( Green Web ),
    local( GreenWeb-Regular ),
    url( GreenWeb.ttf );
}

http://www.broken-links.com/2009/06/30/eck-for-insated-fonts-with-font-face-and- local/“rel=“noreferer”>,其中的内容如下:

问题回答

如果某人仍需要,则:

• 从字体上下载你需要的字体,然后将文件放在:

@font-face { font-family: roboto-regular; src: url( ./fonts/Roboto-Regular.ttf ); }
body {
  font-family: roboto-regular;
}

注:确保通往工作队档案的道路正确。

相反,这是一个老的讨论,但有人来到这个地方,这里还有一些信息。

  1. goto https://google-webfonts-helper.herokuapp.com/fonts
  2. select there the font(s) you need/want
  3. downlaod the selected fonts
  4. copy the displayed css

复印件代码可能无法100%正确,因此低于我使用的内容(并完美运作):

/* open-sans-regular - vietnamese_latin_hebrew_greek_cyrillic     */
@font-face {
font-family:  Open Sans ;
font-style: normal;
font-weight: 400;
font-display: swap;
src: url( fonts/open-sans-v34-vietnamese_latin_hebrew_greek_cyrillic-regular.eot ); /* IE9 Compat Modes */
src: local( ? );
src: url( fonts/open-sans-v34-vietnamese_latin_hebrew_greek_cyrillic-regular.eot?#iefix ) format( embedded-opentype ), /* IE6-IE8 */
url( fonts/open-sans-v34-vietnamese_latin_hebrew_greek_cyrillic-regular.svg#OpenSans ) format( svg ), /* Legacy iOS */
url( fonts/open-sans-v34-vietnamese_latin_hebrew_greek_cyrillic-regular.ttf ) format( truetype ), /* Safari, Android, iOS */
url( fonts/open-sans-v34-vietnamese_latin_hebrew_greek_cyrillic-regular.woff ) format( woff ), /* Modern Browsers */
url( fonts/open-sans-v34-vietnamese_latin_hebrew_greek_cyrillic-regular.woff2 ) format( woff2 ); /* Super Modern Browsers */
}

Inside the edited code you can delete the comments (after each url(..) line. And finally - as tipp: pack the source, in general the packed file is ~ 30% smaller (and your website will have the benefit).

Edit: updated code snippet to be actual. The font ordering is based on the fact, that browsers read from bottom to top (see https://stackoverflow.com/a/22835957/3450837).

还包括使用微笑(你想要使用)的“防弹”解决办法(防止带宽)——见





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签