html – 如何删除webkit中损坏图像的边框?

前端之家收集整理的这篇文章主要介绍了html – 如何删除webkit中损坏图像的边框?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有人可以就此提出建议吗? WebKit浏览器继续在禁用的图像周围放置一个灰色的1px边框.我需要将其删除的原因是电子邮件客户端禁用图像时的电子邮件优化.在Firefox中运行良好,但WebKit浏览器不断显示边框.

我尝试过border:none!在任何地方都很重要,包括内联,但Chrome / Safari很顽固.

编辑:这是带有内联css的示例html

  1. <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" />

解决方法

没有办法删除它,但我将图像包装在其样式中具有溢出隐藏属性的元素中.
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <Meta charset=utf-8 />
  5. <title>Hide Broken Image border</title>
  6. <style>
  7. body{
  8. background-color:azure;
  9. }
  10. .image-container{
  11. width:100px;
  12. height:100px;
  13. overflow:hidden;
  14. display:block;
  15. background-color:orange; /*not necessary,just to show the image Box,can be added to img*/
  16. }
  17. .image-container img{
  18. margin:-1px;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <span class="image-container">
  24. <img src="path-to-image" alt="I'm Broken :(" width="102" height="102">
  25. </span>
  26. </body>
  27. </html>

看看这个垃圾
http://jsbin.com/OpAyAZa/1/edit

猜你在找的HTML相关文章