css - IE 问题 - 在 anchor 中使用跨度使 DIV 可点击

标签 css internet-explorer

我正在使用 span 来填充 anchor 标记内 DIV 的整个宽度和高度,因此整个 DIV 都是可点击的:

<style>
.container {
    background-color: #ffffff;
    float: left;
    height: 90px;
    margin-bottom: 10px;
    position: relative;
    width: 290px;
}

.container span {
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 90001;
    display: block;
}

</style>


<div class="container">
    <a href="#" target="_blank">
        <span></span>
    </a>
</div>

效果很好,但在 IE 9 中似乎无法注册。 DIV 不可点击,不确定为什么 IE 对此有问题?

最佳答案

相反,为什么不这样做:

工作示例:

http://jsfiddle.net/q3PCe/1/

<div class="container">
    <a href="#" target="_blank">

    </a>
</div>

CSS:

a{
    display: block;
    height: 100%;
    width: 100%;
}

关于css - IE 问题 - 在 anchor 中使用跨度使 DIV 可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15750114/

相关文章:

jQuery:cookie 问题 Internet Explorer

javascript - 右键单击显示 Bootstrap 模式 - 多个模式

jquery - jQuery 中的嵌套点击

html - 在下面的标题和文本中使用两个单独的部分制作消息

Windows 7 上 IE 9 中的 HTML 5 Canvas 性能

php - jQuery/Ajax 调用 - 它在 IE7 上不起作用

javascript - 对齐悬停时出现的链接的问题

css - 相同的 css 属性到不同的类/标签

html - 如何修复在 Edge 上运行良好但在 IE 上运行不正常的 CSS

html - 这个href打开新窗口在ie7中不起作用?