简体   繁体   English

字体在IE8和IE9中显得更大

[英]Font appears bigger in IE8 and IE9

I don't understand why the fonts are bigger in IE8 and IE9. 我不明白为什么IE8和IE9中的字体更大。 I am using Helvetica font. 我正在使用Helvetica字体。 All other browsers are okay. 所有其他浏览器都可以。 I got problem only in IE8 and IE9. 我只有在IE8和IE9中有问题。 The line-height is also bigger. 行高也更大。 I cannot post the Link to my site here for some reason. 由于某种原因,我无法将链接发布到我的网站。 But it's really simple use of css. 但这实际上是CSS的简单使用。 Here is how my HTML header looks: 这是我的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>

If this is truly vital, and you do not mind using Conditional Comments to send IE-targeted CSS to the browser, you can create a Conditional Comment stylesheet for IE like: 如果这确实很重要,并且您不介意使用条件注释将IE定位的CSS发送到浏览器,则可以为IE创建条件注释样式表,例如:

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

Otherwise, a good first step is to always use a CSS Reset to normalize between browsers. 否则,一个好的第一步是始终使用CSS Reset在浏览器之间进行标准化。 Commonly used resets is YUI . 常用的重置是YUI

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

Yes IE change the way he read the css or the styling from one version to another. 是的,IE将他阅读CSS或样式的方式从一个版本更改为另一个版本。 In general its only the distance calculation that change. 一般来说,它只是改变距离的计算。 So all the padding/margin. 因此,所有的填充/边距。 line-heigh etc. The same way that when you look at a website in chrome,firefox,saferie,ie the website isn't exactly the same. 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]-->

If you use css: 如果使用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.

Edit: 编辑:

Sorry @Tasos and @user3830694 I was slow to write the post and saw that you provided similar answer by the time I was finished :P 抱歉@Tasos和@ user3830694我写这篇文章很慢,看到我完成时您提供了类似的答案:P

Try modernizr. 尝试modernizr。 It will try to normalize the CSS styling between different browsers. 它将尝试规范不同浏览器之间的CSS样式。

http://modernizr.com/ http://modernizr.com/

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

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