CSS Problem - Link (position:absolute) above a Box not work in IE + Opera

心已入冬 提交于 2019-12-03 12:31:51

It looks like bug in Opera and IE.

There is my hack for Opera and IE9. Add this for .link
background-color: rgba(204,204,204,0.01);

It is very transparent background.

http://jsfiddle.net/UpwvT/19/

It doesn't work in IE8.

Problem is solved - just add transparent background of link in css - for me work fine with transparent gif file.

.link_css{
background: url(path_to_your_file/trans.gif);
}

I used the same solution proposed by Pavlin, but using a 1x1px transparent GIF data-url-encoded, this way:

.link_css{
  background: url('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
}

So you avoid an extra http request to the server with very few bytes of increase in the CSS stylesheet. Data-url is supported in IE8+.
http://caniuse.com/datauri

Olivier

Still don't get where this error comes from... Personnally I just put some fully transparent bg there

background: rgba(0,0,0,0);

how about placing the link tag(a) around the div like so:

<a class="link" href="http://google.com">
    <div class="box">
        some text
        <div class="linkbox">
            &nbsp;
        </div>

    </div>
</a>

EDIT

The folowing should be possible too:

<div class="box">
    <a class="link" href="http://google.com">
        some text
        <div class="linkbox">
            &nbsp;
        </div>
    </a>
</div>

I beleve that should fix it.

Don't need to add linkbox inside box like this:

<div class="box" onclick="location.href='http://google.com'">
    some text
</div>

And define styles like this:

<style>
    .box {
        width:200px;
        height:200px;
        background:#ccc;
        position:relative;
        text-align:center;
        z-index:1;
        cursor: pointer;
        cursor: hand;
    }
</style>

Working Demo: http://jsfiddle.net/rathoreahsan/cLmqe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!