img[src=””] img标签无路径情况下,灰色边框去除解决方案
1.Js解决办法
@@##@@ function whenError(a){ a.onerror=null; a.src='path_default.jpg'; console.log('图片出错的时候调用默认的图片'); }
2.绝对定位聚焦解决方案
absolute聚焦解决方案 @@##@@
.container-img { position: relative; display: inline-block; width: 36px; height: 36px; overflow: hidden; } .container-img img { position: absolute; top: -1px; right: -1px; background: url(img/common-icon.png) no-repeat; background-position: 0px 1px; }
3.margin聚焦解决办法
margin聚焦解决方案 @@##@@
.container-img { display: inline-block; width: 36px; height: 36px; overflow: hidden; } .common-icon { display: inline-block; background: url(img/common-icon.png) no-repeat; background-position: 0px 1px; margin: -1px; }
4.css隐藏
img[src=""]{opacity: 0;}
以上就是详解img[src=””] img无路径情况下,灰色边框去除解决方法的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1608351.html
微信扫一扫
支付宝扫一扫