Html Internet Explorer 显示带有彩色边框的图像链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9249244/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:28:36  来源:igfitidea点击:

Internet explorer displaying image links with colored border

htmlcssinternet-explorerimage

提问by Tibi

I have the following CSS code for links:

我有以下链接的 CSS 代码:

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

a:hover {
    color: #8DCFF7;
}

The problem is that in Internet Explorer, images have a strange border with the same color as 'color'. How can I fix this, and draw images correctly. The HTML code is simple: <a href="calculator-operators.htm"><img src="img/link.png" /></a>

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

Screenshot:So, how can I fix this problem?

截屏:那么,我该如何解决这个问题?

回答by Klaus Byskov Pedersen

Just specify no border for the images:

只需为图像指定无边框:

a > img{
    border: 0;
}

回答by devdigital

Use

img {
   border: 0;
}

I would consider using a resetstylesheet, or a normalisingstylesheet to provide consistency in styling across all browsers. This fix is part of those stylesheets.

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

回答by C Travel

Its an old post i see, but i thought, why not. There is an other solution by using border:none;:

这是我看到的旧帖子,但我想,为什么不呢。使用border:none;以下方法还有另一种解决方案:

a img {
   border:none; 
}

回答by Melvin

just set the border from all image to 0 px

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

   img { border: 0px }

回答by ParPar

Try

尝试

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