【问题标题】:Font appears bigger in IE8 and IE9字体在 IE8 和 IE9 中显得更大
【发布时间】:2014-07-18 22:32:23
【问题描述】:

我不明白为什么 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>

【问题讨论】:

  • 那么你的 CSS 在哪里?如果没有您的 CSS,我们将无能为力;)在这种情况下,您的 &lt;head&gt; 毫无用处。 viewport 元标记适用于智能手机等其他设备,以确保您无法缩放视口并始终获得正确的初始比例。
  • 你是对的 Imrul.H。文本在不同的浏览器上确实显示不同。这是生活中的事实。 css-tricks.com/…

标签: html css font-size


【解决方案1】:

如果这真的很重要,并且您不介意使用条件注释将针对 IE 的 CSS 发送到浏览器,您可以为 IE 创建一个条件注释样式表,例如:

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

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

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

【讨论】:

    【解决方案2】:

    是的,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

    【讨论】:

      【解决方案3】:

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

      http://modernizr.com/

      【讨论】:

        猜你喜欢
        • 2015-02-06
        • 2012-04-06
        • 1970-01-01
        • 1970-01-01
        • 2012-07-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-12-23
        相关资源
        最近更新 更多