IE8和Below inline-block CSS [英] IE8 and Below inline-block CSS

查看:119
本文介绍了IE8和Below inline-block CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我知道IE8和下面不喜欢 inline-block ,但我读到 inline 相同的行为。所以我修改将我的 main.css 复制到 main-ie8below.css 并更改了所有 inline -block inline 。我使用以下代码尝试并实现这一点:

So I know that IE8 and below does not like inline-block but I read that inline should result in the same behavior. So I modified copied my main.css to main-ie8below.css and changed all inline-block to inline. I use the following code to try and achieve this:

        <!--[if lte IE 8]>
            <link rel="stylesheet" type="text/css" href="/media/css/main-ie8below.css" />
        <![endif]-->
        <!--[if gt IE 8]>
            <link rel="stylesheet" type="text/css" href="/media/css/main.css" />
        <![endif]-->
        <!--[if !IE]><!-->
            <link rel="stylesheet" type="text/css" href="/media/css/main.css" />
         <!--<![endif]-->

但是,这不工作。似乎我的if语句不正确。

However, this is not working. It seems that my if statements are incorrect. Is that the case, or am I missing something else?

这里是有问题的HMTL(无用的东西被删除):

Here is the HMTL in question (useless stuff removed):

    <nav id="main_nav" role="navigation"><!--
                            <div><a href=""><img src=""  /></a></div><!--
                    --><div><a href=""><img src=""  /></a></div><!--
                    --><div><a href=""><img src=""  /></a></div><!--
                    --><div><a href=""><img src=""  /></a></div><!--
                    -->

这里是一个小提琴,除了没有图片:

Here is a fiddle, except without images:

http://jsfiddle.net/bqXsU/

推荐答案

原来是HTML5的元素不能被IE8识别的错误。通过添加HTML5shiv我能够解决它。

It turned out to be the fault of HTML5 elements not being recognized by IE8. By adding HTML5shiv I was able to fix it.

这篇关于IE8和Below inline-block CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆