我有一个相对定位的DIV。整个DIV需要链接到另一个页面。

我正在做的是在div中添加一个链接并将此CSS应用于它:

.f170region .linkcover {
    background: #FFF;
    bottom: 0;
    display: block;
    filter: alpha(opacity=0);
    hasLayout: true;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 999;
}


这在IE6以外的所有浏览器中的作用是使链接充当DIV上的可点击层。链接上还添加了一个.ir类,以隐藏屏幕外链接中的文本:

.ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; }


任何人都可以找到解决方案,以使其在IE6中正常工作。而且,请不要给我有关支持IE6的讲座。我和你在一起。

这是使用此方法的HTML:

    <div class="alpha omega grid_4 f170region white" id="home_bg_youthzone">
        <h2 class="hidden">Youth Zone</h2>
        <div class="copy">There are many ways for younge residents to get help and support. Find out more...</div>
        <div class="getin">
            <p><span class="pink">Get</span><br />involved</p>
            <p><span class="pink">Get</span><br />in the zone</p>
        </div>
        <a class="linkcover ir" href="<?php echo site_url("/youth-zone/"); ?>" title="Go to Youth Zone">Go to Youth Zone</a>
    </div>


编辑2:

http://jsfiddle.net/9gSUd/

最佳答案

我找到了使用spacer.gif文件作为BG的解决方案。我正在使用此修复程序来使叠加层在IE http://kevindees.cc/2011/01/ie-adjacent-positioning-image-and-link-overlap-css-fix/中正常工作

这会将BG设置为白色,但将不透明度设置为0。这在IE6以外的所有版本的IE中都可以使用。通过将背景设置为spacer.gif而不是白色,并将链接的宽度/高度设置为100%,我在IE6和所有浏览器中获得了有效的解决方案。这是链接的最终CSS:

.f170region .linkcover {
    background: url(../images/spacer.gif) no-repeat 0 0;
    bottom: 0;
    display: block;
    filter: alpha(opacity=0);
    height: 100%;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 999;
}

10-05 21:02
查看更多