我正在使用 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 对此有问题?
最佳答案
相反,为什么不这样做:
工作示例:
<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/