css - @font-face 在 MAC (Chrome/Safari) 上不显示 block 元素

标签 css macos safari font-face

我在 Mac 上的 Safari 和 Chrome 中使用嵌入字体格式化任何 block 元素时遇到问题。 所有 Windows 浏览器(IE、Firefox、Chrome 甚至 Safari)的格式都是正确的,并且内联元素的字体正确显示。我已将 html 剥离为仅包含以下基础知识,但仍然存在此问题 - 我缺少什么??

@font-face { font-family: yowieFont; src: url(/template/GROBOLD.ttf); font-weight:normal; font-style:normal; font-variant:normal;}
h1 { font-family: yowieFont; color: #ed2249;}
h2 { font-family: yowieFont; color: #ed2249;}
h3 { font-family: yowieFont; color: #ed2249;}
p { font-family: yowieFont; color: #ed2249;}
span { font-family: yowieFont; color: #ed2249;}

<h1 style="display: inline;">1: CONTACT US</h1>
<h1 >1: CONTACT US</h1>
<h2 >2: CONTACT US</h2>
<h3 >3: CONTACT US</h3>
<p >P: CONTACT US</p>
<span>span: CONTACT US</span>

最佳答案

我通过 font squirrel 工具运行字体解决了这个问题: fontsquirrel.com/tools/webfont-generator

该工具生成所需的不同 Web 格式并修复了我在使用此字体时遇到的行高问题

@font-face {
  font-family: 'yowieFont';
  src: url('/template/grobold-webfont.eot');
  src: url('/template/grobold-webfont.eot?#iefix') format('embedded-opentype'),
  url('/template/grobold-webfont.woff') format('woff'),
  url('/template/grobold-webfont.ttf') format('truetype'),    
  url('/template/grobold-webfont.svg#groboldmedium') format('svg');
  font-weight: normal;
  font-style: normal;
}

关于css - @font-face 在 MAC (Chrome/Safari) 上不显示 block 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22767056/

相关文章:

macos - 如何检测文件是否被关闭?

CSS3 动画方向反转在 Safari 中不起作用

javascript - 为什么在 Safari 中使用 JavaScript 计划 Q1 year 22034 不可靠?

css - 使用非相对值将具有固定位置的元素居中

html - 右对齐单元格表格中的文本,但向右添加 'variable' 填充以从表格边框创建空间

c# - 如果元素上有类,则 CSS 选择器应用 CSS

html - 在 Safari 中打印时不会出现某些文本

javascript - Materialise CSS - Select 在 DOM 中没有名称或正确的值

macos - Mac 守护进程 howto(由 'book' 提供)

c# - 单声道在 OS X 上缺少 HttpUtility?