在IE8中锚链接和css透明的背景图像

时间:2014-03-14 13:06:54

标签: html css internet-explorer-8 opacity

HTML代码

<div class="thumbnail-wrapper">
    <a tabindex="-1" class="thumbnail select" style="background-image: url(http://localhost/RP/assets/images/hero/01.jpg); width: 157px; height: 87px;" data-index="0">
        <div class="caption" style="bottom: 0px;">Sport's live FA Cup games revealed</div>
    </a>
    <span class="pointer" style="display: inline;"></span>
    <a tabindex="-1" class="gal-type"></a>
</div>

IE CSS

.thumbnail-wrapper .thumbnail.select {
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
    filter: alpha(opacity=70);
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
    zoom:1;
    display: inline-block;
    position:absolute ; // this is not needed but I gave at least this could help
}

我已经提供了几个过滤器属性,但没有运气。

2 个答案:

答案 0 :(得分:1)

在锚链接中添加图像叠加层。像这样的东西

HTML代码

<div class="thumbnail-wrapper">
    <a tabindex="-1" class="thumbnail select" style="width: 157px; height: 87px;" data-index="0">
        <div class="overlay"></div>
        <div class="caption" style="bottom: 0px;">Sport's live FA Cup games revealed</div>
    </a>
    <span class="pointer" style="display: inline;"></span>
    <a tabindex="-1" class="gal-type"></a>
</div>

IE CSS

.thumbnail-wrapper .thumbnail.select {
    display: inline-block;
    position:relative;
}

.thumbnail-wrapper .thumbnail.select .overlay {
    background : url(http://localhost/RP/assets/images/hero/01.jpg);
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
    filter: alpha(opacity=70);
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
    position:absolute;
    top:0;
    left:0;
    width:157px;
    height:87px;
}

答案 1 :(得分:0)

仅针对任何属性之前使用星号*的IE的目标样式。

*filter: alpha(opacity=70);

这样该属性就不会与其他属性发生冲突。