css - 在 CSS 中针对 IE8(更少)?

标签 css less

这是我的 CSS:

.lt-ie8{
    body{
        display:none!important;
    }
}

这是我的 HTML:

<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>

CSS 似乎没有正确定位 IE7,有人知道我哪里出错了吗?

最佳答案

这对我来说非常有效。

<html>
<head>
    <title></title>
    <style type="text/css">
        .test{
            background: green;
            height: 100px;
            width: 100px;
        }
    </style>
    <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8">
        <style type='text/css'>
            .test{
                background: red;
            }
        </style>
    <![endif]-->
    <!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
    <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->

</head>
<body>
    <div class="test"></div>
</body>
</html>

关于css - 在 CSS 中针对 IE8(更少)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16445765/

相关文章:

php - 使用 PHP 自动将引用的 LESS 文件编译成 CSS

css - 更少无法识别的输入

javascript - 我的 HTML/CSS 不允许我与我的程式化复选框进行交互

css - 悬停时的@keyframes

html - CSS 有选择地应用样式

css - meteorjs 如何导入 wrapbootstrap 主题

php - PHP中具有重要路径定义的文件

html - 如何使用具有相同顺序的 flexbox 创建照片网格

css less mixin rem 计算器而不被定向到字体或其他东西

jquery - 使用 jquery 即时修改 CSS