bba*_*tos 12 css font-size internet-explorer-9
我正在编写网站的CSS,并意识到Internet Explorer 9显示的是与其他浏览器(Firefox,Chrome,Safari,IE7和IE8)相比不同的字体大小.
我尝试使用一些RESETS,我指定了字体px,但IE9仍然显示字体大小的差异.
我已经尝试使用font-size中pt,in,百分比,但没有成功.
之前我改变了字体(Georgia,Times New Roman,Verdana).其中一些显示较大,另一些在IE9中较小.
我在IE中检查了缩放设置和文本大小.它们分别为100%和中等.
为了说明,我创建了一个简单的HTML和CSS,您可以看到下面的代码.如何解决这个问题呢?谢谢!
问题:

码:
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Untitled Document</title>
</head>
<body>
<p>
AAAAA BBBBB CCCCC DDDDD EEEEE FFFFF GGGGG HHHHH IIIII JJJJJ KKKKK LLLLL MMMMM NNNNNN OOOOO PPPPP QQQQQ
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
CSS
/* RESET */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* END OF RESET */
body {
background-image:url(GreenLine.png);
background-repeat:no-repeat;
font-family:"Courier New", Courier, monospace;
font-size:12px;
}
Run Code Online (Sandbox Code Playgroud)
IE9使用DirectWrite渲染文本,而其他浏览器则不使用(Firefox 4+除外).
这就是两个浏览器之间文本大小略有不同的原因.
没有办法使文本大小相同.
阅读:http://www.basschouten.com/blog1.php/font-rendering-gdi-versus-directwrite
这一点,特别是"暗示和间距差异"部分:http://blog.mozilla.com/nattokirai/2011/08/11/directwrite-text-rendering-in-firefox-6/
Jas*_*aro -2
有两种可能的情况,均未经测试:
尝试将文档类型更改为 xhtml 过渡以外的其他内容。看看 HTML5 文档类型是否能更好地呈现它。<!DOCTYPE html>
尝试仅使用font-family: monospace;看看是否是字体问题。
编辑
如果这些不起作用并且您找不到解决方案,您可能需要font-size使用条件注释为 IE9 提供不同的服务。