【问题标题】:split background color that's supported by ie8+ [duplicate]ie8 +支持的拆分背景颜色[重复]
【发布时间】:2015-03-27 20:33:12
【问题描述】:

我想分割我拥有的几个按钮的背景颜色,最好是百分比,因为会有 2 到 3 种颜色。我现在拥有它的方式适用于 chrome 和 ie10。我想用这个功能支持 ie8 和 9。

    <div class="col-sm-12 no-wrap">
        <input type="text" class="text-input">
        <button type="button" id="search-glyph"><span class="glyphicon glyphicon-search search-glyph"></span></button>
    </div>

这是我想使用它的示例(需要引导程序)。搜索栏附有一个按钮。该按钮将具有顶部颜色(较浅的红色)和底部较暗的搜索图标。这是我目前正在使用的 css。

.text-input {
float: left;
padding-left: 10px;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
background-color: #f0f0f0;
width: 200px;
height: 34px;
border-top: 1px solid #231f20;
border-left: 1px solid #231f20;
border-bottom: 1px solid #231f20;
border-right: 0;
}

.text-input:focus {
outline-color: #ed1c24;
}

#search-glyph {
text-align: center;
height: 34px;
width: 34px;
color: #ffffff;
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
border-top: 1px solid #231f20;
border-right: 1px solid #231f20;
border-bottom: 1px solid #231f20;
background: linear-gradient(#d91616 50%, #c20404 50%);
border-left: 0;
}

#search-glyph:focus {
outline: 0;
}

问题在于 ie 8 和 9 不支持线性渐变。任何人都可以在这些浏览器版本中使用它吗?

【问题讨论】:

    标签: html css twitter-bootstrap internet-explorer


    【解决方案1】:

    您可以使用以下功能,适用于 IE6-9

    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d91616', endColorstr='#c20404',GradientType=1 ); /* IE6-9 */
    

    【讨论】:

    • 这会在 ie8 中产生渐变 :( 我只想从中间直接分割。
    【解决方案2】:

    对于渐变的跨浏览器兼容性,最好使用以下站点:

    http://www.colorzilla.com/gradient-editor/

    它在简化它方面做得非常出色!

    【讨论】:

    • 这个网站很棒并且可以正常工作,但不适用于 ie 8- 中的简单拆分。结果是一个渐变,我在 ie8 中更倾向于半黑半白
    • @davidcarek 如果这个网站不支持它,那么你不能用渐变来解决它。无论如何,IE8看起来那么好有多重要..?我通常会选择“如果它可以工作并且看起来很适合 IE8”标准...
    • 看起来不错,但我想我会用图片代替背景。
    猜你喜欢
    • 1970-01-01
    • 2010-10-14
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 2013-09-02
    • 1970-01-01
    • 2019-02-24
    • 1970-01-01
    相关资源
    最近更新 更多