IE 8特定样式表将无法使用条件注释

时间:2015-02-12 02:25:06

标签: html css internet-explorer conditional-comments

我的网站上只有“#34;为什么这个文字很小?"屏幕上。它正确响应应用于它的CSS样式,但不在IE 8中

html是:

<!--[if IE 8 ]>
  <p>Only IE 8 will see this</p>
<![endif]-->

<div class="font4">Why is this text small?</div>

和&#34; font4&#34;的样式在顶部的样式标签内,是:

.font4 {
    margin-top: 4%;
    margin-bottom:3%;
    color: #030;
    font-family: "Times New Roman", Times;
    font-size: 6vh;
    text-align:center;
}

但如果我在IE 8中查看它,它显示的太小,如下:

screenshot

所以我把这个html放在头上:

<!--[if IE 8]>
    <link rel="stylesheet" type="text/css" href="http://testsite24.netai.net/public/ie8.css">
<![endif]-->

和ie8.css正确链接。 ie8.css的代码是:

@charset "utf-8";
/* CSS Document */

.font4 {
    margin-top: 4%;
    margin-bottom:3%;
    color: #030;
    font-family: "Times New Roman", Times;
    font-size: 10vh;
    text-align:center;
}

但为什么它没有回复font-size: 10vh;

您可以在此处查看我的网站:http://testsite24.netai.net/public/demo.html

谢谢!

1 个答案:

答案 0 :(得分:2)

这只是因为viewport-percentage lengths vhnot supported in IE8,{{3}}。