【问题标题】:Bootstrap - CSS - Copy Firefox style to IE8?Bootstrap - CSS - 将 Firefox 样式复制到 IE8?
【发布时间】:2014-03-26 00:05:30
【问题描述】:

我有一个使用 bootstrap v2 的页面,它在 Firefox 中运行良好,我想在 IE8 中应用相同的 css 颜色样式,但我不知道该怎么做:

.navbar-inverse .navbar-inner { 
    background-color: #1b1b1b; 
    background-image: -moz-linear-gradient(top, #fabc75, #fa8a07); 
    /* 
    The above works in Firefox, I want to have the same work in IE8 but 
    don't know which of the below to edit
    */ 
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222), to(#111)); 
    background-image: -webkit-linear-gradient(top, #222, #111); 
    background-image: -o-linear-gradient(top, #222, #111); 
    background-image: linear-gradient(to bottom, #222, #111); 
    background-repeat: repeat-x; 
    border-color: #252525; 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
}

【问题讨论】:

    标签: css twitter-bootstrap


    【解决方案1】:

    渐变在 IE8 中不起作用,您可以使用这样的图像:

    <!--[if lte IE 8]>
    <style type='text/css'>
        .navbar-inverse .navbar-inner {
            background: url('gradient.jpg') repeat-x;
        }
    </style>
    <![endif]-->
    

    更多技巧在这里:http://browserhacks.com/

    【讨论】:

    • 如何指定纯色?
    • 您可以像这样添加颜色:background: #ff0000 url('gradient.jpg') repeat-x;background-color: #ff0000;
    • 其实我找到了答案,贴在这里。
    【解决方案2】:

    好像支持这个:

    IE8 gradient filter not working if a background color exists

    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fabc75', EndColorStr='#fa8a07');
    

    希望这对其他人有所帮助。

    【讨论】:

    • 是的,你说得对,它是一个更新。抱歉回复错误。但是您将尝试在原始 IE8 中进行测试,而不是在仿真模式下。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-29
    • 2011-02-25
    • 2022-10-02
    • 1970-01-01
    • 2021-09-08
    • 1970-01-01
    相关资源
    最近更新 更多