有人可以就此提出建议吗? WebKit浏览器继续在禁用的图像周围放置一个灰色的1px边框.我需要将其删除的原因是电子邮件客户端禁用图像时的电子邮件优化.在Firefox中运行良好,但WebKit浏览器不断显示边框.
我尝试过border:none!在任何地方都很重要,包括内联,但Chrome / Safari很顽固.
编辑:这是带有内联css的示例html
- <img style="outline:none;text-decoration:none;display:block;border:none;-webkit-border:0;" border="0" src="images/rm_bnk.gif" width="10" height="10" alt="test" />
解决方法
没有办法删除它,但我将图像包装在其样式中具有溢出隐藏属性的元素中.
- <!DOCTYPE html>
- <html>
- <head>
- <Meta charset=utf-8 />
- <title>Hide Broken Image border</title>
- <style>
- body{
- background-color:azure;
- }
- .image-container{
- width:100px;
- height:100px;
- overflow:hidden;
- display:block;
- background-color:orange; /*not necessary,just to show the image Box,can be added to img*/
- }
- .image-container img{
- margin:-1px;
- }
- </style>
- </head>
- <body>
- <span class="image-container">
- <img src="path-to-image" alt="I'm Broken :(" width="102" height="102">
- </span>
- </body>
- </html>