【问题标题】:Internet explorer displaying image links with colored borderInternet Explorer 显示带有彩色边框的图像链接
【发布时间】:2013-12-11 18:03:33
【问题描述】:

我有以下用于链接的 CSS 代码:

a {
    text-decoration: none;
    color: #248AC9;
}

a:hover {
    color: #8DCFF7;
}

问题在于,在 Internet Explorer 中,图像具有与“颜色”相同颜色的奇怪边框。我该如何解决这个问题,并正确绘制图像。 HTML 代码很简单: <a href="calculator-operators.htm"><img src="img/link.png" /></a>

那么,我该如何解决这个问题呢?

【问题讨论】:

标签: html css internet-explorer image


【解决方案1】:

只需为图像指定无边框:

a > img{
    border: 0;
}

【讨论】:

  • 这解决了问题...谢谢 :) 我更喜欢这个解决方案,因为它不会干扰其他(非链接)img 样式。
  • 请注意,使用零值时无需指定单位类型。即0;就足够了。
  • 怎么,对于如此常见的事情,这个 Q&A 没有被投票得更高?!
【解决方案2】:

使用

img {
   border: 0;
}

我会考虑使用reset 样式表或normalising 样式表来提供跨所有浏览器的样式一致性。此修复程序是这些样式表的一部分。

【讨论】:

    【解决方案3】:

    我看到了一篇旧帖子,但我想,为什么不呢。使用border:none;还有另一种解决方案:

    a img {
       border:none; 
    }
    

    【讨论】:

      【解决方案4】:

      只需将所有图像的边框设置为 0 像素

         img { border: 0px }
      

      【讨论】:

        【解决方案5】:

        试试

        a { 
            text-decoration: none; 
            border:0;
            color: #248AC9; 
        } 
        

        【讨论】:

        • 这不起作用。而且用白色绘画不是解决方案……背景是非常浅的灰色,而不是白色。
        猜你喜欢
        • 2010-11-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-23
        • 2016-09-12
        • 1970-01-01
        • 1970-01-01
        • 2013-05-17
        相关资源
        最近更新 更多