【发布时间】:2016-11-22 12:45:00
【问题描述】:
我在 Firefox 和 chrome 中的字体渲染有一个奇怪的问题。在 chrome 中,字体似乎有点大(虽然不是很明显)。因此,它出现在另一条线上。截图附在下面(第一张图片是chrome,第二张是firefox)。
我在页面中使用 bootstrap 3.3.6、font-awesome 4.6.1、jquery-1.11.2.min.js 和 prettyphoto。
我正在使用字体大小:16px(我也尝试过 1em),字体粗细:400,文本渲染:优化易读性,行高:1.6 用于“p”标签
和 font-family:Arial,Helvetica,sans-serif 和 font-style :normal 继承自'body'
3 列是 bootstrap 的 col-md-4,firebug 和开发者工具栏中的布局显示它的宽度应该是 310px(带有 15px 填充)。
CSS 是这样的
body{ color:#333;cursor:default;font-family:Arial,Helvetica,sans-serif;font-style:normal;font-weight:400;line-height:22px;position:relative;margin:0; background:#153b5d url(../img/bg.png) repeat-x;}
p{font-family:inherit;font-size:1em;font-weight:400;line-height:1.6;text-rendering:optimizelegibility;}
谁能告诉我我做错了什么。谢谢。
编辑:我试图把它作为一个 sn-p。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<style>
*,
a:hover,
a:active,
a:focus {
outline: 0;
}
body {
color: #333;
cursor: default;
font-family: Arial, Helvetica, sans-serif;
font-style: normal;
font-weight: 400;
line-height: 22px;
position: relative;
margin: 0;
background: #153b5d url(../img/bg.png) repeat-x;
font-size: 16px;
}
p {} .container {
background: #FFF;
max-width: 1020px;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-4">
<p>For a long lasting freshness feeling; Removes stubborn odour from textiles.</p>
</div>
<div class="col-md-4">
<p>Unpretty deo and sweat stains on your shirt?
<br>Now Dr. Beckmann stain spray deo & sweat provides a way out.</p>
</div>
<div class="col-md-4">
<p>Every stain is different; For each stain the perfect specialist.</p>
</div>
</div>
</div>
【问题讨论】:
-
你没有做错任何事情,不同的浏览器呈现不同的字体,它们在各个方面总是存在细微的差异。请看看这个其他问题,它可能会有所帮助:stackoverflow.com/questions/4899792/…
-
而那个细微的差别就扼杀了我的布局。我给 div 指定了最小高度,但在 chrome 中,布局比最小高度高
-
请马修也发布您的 HTML。最好用 HTML / CSS 重现问题
-
我已经添加了 sn-p。您可以在 chrome 和 firefox 中进行比较。正如@Forty 所说,我可能不得不忍受这一点。只需增加我的最小高度并节省一些时间:)
-
我个人会做的是使字体大小稍微小一点,以便两者都适合,或者使容器更大(10-20px 可能就足够了)。如果您首先使用 FF,提醒自己在此类情况下为 chrome 留出更多空间是避免遇到此问题的简单方法。
标签: html css google-chrome firefox fonts