简体   繁体   中英

Background image for anchor link and css transparent in IE8

HTML code

<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
}

I have given several filter properties, But no luck.

Add image overlay inside the anchore link. Something like this

HTML code

<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;
}

target styling only for IE using asterisk * before any attribute.

*filter: alpha(opacity=70);

So that the attribute doesn't conflict with other attributes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM