繁体   English   中英

字体在IE8和IE9中显得更大

[英]Font appears bigger in IE8 and IE9

我不明白为什么IE8和IE9中的字体更大。 我正在使用Helvetica字体。 所有其他浏览器都可以。 我只有在IE8和IE9中有问题。 行高也更大。 由于某种原因,我无法将链接发布到我的网站。 但这实际上是CSS的简单使用。 这是我的HTML标头的外观:

<!DOCTYPE html>
<html lang="se">
<head>
    <meta charset="utf-8">
    <title>Digi...</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />

    <link rel="shortcut icon" href="/resources/layout/favicon.ico" type="image/x-icon" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">

</head>

如果这确实很重要,并且您不介意使用条件注释将IE定位的CSS发送到浏览器,则可以为IE创建条件注释样式表,例如:

<!--[if IE 9]>
    <link rel="stylesheet" type="text/css" href="/ie9.css" />
<![endif]-->

否则,一个好的第一步是始终使用CSS Reset在浏览器之间进行标准化。 常用的重置是YUI

看到这个:http: //yuilibrary.com/yui/docs/cssreset/

是的,IE将他阅读CSS或样式的方式从一个版本更改为另一个版本。 一般来说,它只是改变距离的计算。 因此,所有的填充/边距。 line-heigh等。以相同的方式访问chrome,firefox,saferie中的网站时,即该网站并不完全相同。

If the problems is really important for you (normally I ajust the css so that even with the         difference the website) you can use CSS Conditionnal comment like this :
<!--[if IE 7]><html lang="en" class="ie ie7"><![endif]-->
<!--[if IE 8]><html lang="en" class="ie ie8"><![endif]-->
<!--[if IE 9]><html lang="en" class="ie ie9"><![endif]-->
<!--[if !IE]><!--><html lang="en"><!--<![endif]-->

如果使用css:

.ie8 body {
//IE 8 CSS
}
.ie9 body {
 //IE 9 CSS
 }


Or use the tag on you're meta tag
<!--[if IE 8]><meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=0.8, minimum-scale=0.8, maximum-scale=0.8"><![endif]--> 
(or change the scale to whatever you want) do the same for IE 9.

编辑:

抱歉@Tasos和@ user3830694我写这篇文章很慢,看到我完成时您提供了类似的答案:P

尝试modernizr。 它将尝试规范不同浏览器之间的CSS样式。

http://modernizr.com/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM