IE7下a标签下包含图片时无法点击的问题
来源:互联网 发布:山东交通学院网络教学 编辑:程序博客网 时间:2024/05/09 08:49
代码:
<a class="room-item not-got" href="/room/13001.htm" target="_blank">
<div class="avatar-box"><img src="$imagePrefix/201612_snowflower_pc/snow.png" class="avatar">
<img src="$imagePrefix/201612_snowflower_pc/avatar_frame.png" class="bg">
<p class="nickname ellipsis">1昵称要尽量很长哦</p>
</div>
<div class="send-btn not-allow"></div>
</a>
.room-item{
width:146px;
height: 206px;
float:left;
margin-right: 50px;
.avatar-box{
width: 142px;
height: 150px;
position: relative;
.avatar{
width: 126px;
height: 126px;
position: absolute;
top:12px;
left:8px;
}
.bg{
width: 142px;
height: 150px;
}
.nickname{
color:#fff;
text-align: center;
position: absolute;
bottom:72px;
width:120px;
left:4px;
padding:0 5px;
font-size: 14px;
text-align: center;
}
}
IE7下图片无法点击,其他浏览器正常。
https://segmentfault.com/q/1010000000712673 这里有类似例子,HTML 4.01规定<a>
只应包含inline元素,而<div>
是一个block元素,不过HTML 5倒是不再这么要求了。这是因为a标签是属于行内元素,在老的游览器(包括ie7)中行内元素内部不能放块元素。
修改后的代码:a加了display:block;position:relative; p标签换成span
html:
<a class="room-item not-got" href="/room/13001.htm" target="_blank">
<span class="avatar-box">
<img src="$imagePrefix/201612_snowflower_pc/snow.png" class="avatar">
<img src="$imagePrefix/201612_snowflower_pc/avatar_frame.png" class="bg">
<span class="nickname ellipsis">1昵称要尽量很长哦</span>
</span>
<div class="send-btn not-allow"></div>
</a>
sass:
.room-item{
width:146px;
height: 206px;
float:left;
margin-right: 50px;
display: block;
position: relative;
.avatar-box{
width: 142px;
height: 150px;
.avatar{
width: 126px;
height: 126px;
position: absolute;
top:12px;
left:8px;
}
.bg{
width: 142px;
height: 150px;
}
.nickname{
color:#fff;
text-align: center;
position: absolute;
bottom:72px;
width:120px;
left:4px;
padding:0 5px;
font-size: 14px;
text-align: center;
}
}
- IE7下a标签下包含图片时无法点击的问题
- ie6,ie7下a标签无法点击
- css实际技巧---<a>标签中有文字图片ie7下不显示图片的问题
- ie7,ie8下 使用绝对定位的a标签点击失效解决办法
- IE7下的a标签href属性相对路径和全路径的问题
- IE7下解决A标签使用padding宽度自适应 padding失效的问题
- a标签包裹button在IE6,IE7下的bug
- 图片验证码在FireFox、IE7下无法刷新问题的解决
- IE6下a标签无法点击bug 以及扩展
- IE6下a标签无法点击bug----position和定义的宽度和高度
- IE7/8下 Fiddler 无法本地调试的问题
- IE7下不允许显示用户本地图片的问题
- 解决IE7下不能预览图片的问题
- IE6、IE7的a标签下划线问题
- IE6 IE7 下禁止点击时虚线框的显示
- a标签嵌套img标签在IE7,8下显示带有蓝色边框border的解决方法
- 解决IE7下本地图片预览问题
- 解决IE下a标签点击有虚线边框的问题
- PAT L1-009. N个数求和(辗转相除法,浮点和输出注意)
- 日程控件XtraScheduler
- eclipse:retry error, curr request is null 运行app无网络
- 使用Application Loader发布APP(Xcode发布成功但构建本不显示)
- linux下挂载iso镜像的方法
- IE7下a标签下包含图片时无法点击的问题
- Android Animation 动画的使用方法和介绍
- 期刊摘录《ORACLE数据库SQL优化原则》
- ECG-心电图-WFDB工具集的研究与理解
- 一篇较为详细的 ios静态动态库 的使用方法总结
- Apache kafka 工作原理介绍
- Linux学习总结(19)——Linux中文本编辑器vim特殊使用方法
- LeetCode笔记:1. Two Sum
- Android Studio: Sources for 'Android API 25 Platform' not found