html - Chrome 中自定义字体的额外填充或边距

标签 html css google-chrome font-face

我下载了一些字体作为工具包(ttf、eot、woff 等)。但是,在 Chrome 中,它们似乎有额外的 paddingmargin,这些在 Internet Explorer 或 Firefox 中不会显示。它似乎是顶部和底部。

我做了所有明显的 CSS 技巧,例如:

margin: 0;
padding: 0;

但这似乎是字体本身的问题。

这是其中一种字体:

@font-face {
    font-family: 'Bebas';
    src: url('bebas.eot');
    src: url('bebas.eot?#iefix') format('embedded-opentype'), url('bebas.woff') format('woff'), url('bebas.svg#BebasRegular') format('svg'), url('bebas.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

有没有人知道任何编码技巧来修复或更好的转换/下载方法?

最佳答案

FOR LIVE DEMO

Bebas Neue 可在直接链接源上获得。 margin 0 和 padding 0 函数似乎工作正常。

tested in Chrome - works
tested in IE7 - works


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script type="text/javascript"  src='http://cdn.renderedfont.com/js/renderedfont-0.8.min.js#free'></script>


  body
  {
    margin: 0;
    padding: 0;
  }
  h1
  {
    font-family: "Bebas Neue", Arial; 
    font-size: 40px; 
    color: #99f;
  }



<h1 class="renderedFont">Bebas Neue</h1>

关于html - Chrome 中自定义字体的额外填充或边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18219986/

相关文章:

google-chrome - voiceSynthesis.speak 在 chrome 中不起作用

google-chrome - Nginx 反向代理适用于 Safari 和 Firefox,但不适用于 Chrome

html - 我是否需要在自定义单选按钮上使用 ARIA 角色属性以符合可访问性指南?

javascript - jQuery AJAX - 获取失败的详细信息并插入到 DIV 中

jquery - 将小部件添加到仪表板

javascript - YUI 对话框/面板在 IE iframe 中无法正确呈现

html - 如何显示标题文本后面的背景图像?

javascript - 使用 JavaScript 获取伪元素属性

html - 在按钮之间放置边距

javascript - Google Chrome 66 如何自动播放无声视频大屏幕