Html 如何去除超链接图像周围的黑色边框?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49966/
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:13:04  来源:igfitidea点击:

How to remove black border around hyperlinked image?

htmlcsscross-browser

提问by Eric

When I turn an image (<img>) into a hyperlink (by wrapping it in <a>), Firefox adds a black border around the image. Safari does not display the same border.

当我将图像 ( <img>) 转换为超链接(通过将其包裹在 中<a>)时,Firefox 会在图像周围添加黑色边框。Safari 不显示相同的边框。

What CSS declaration would be best to eliminate the border?

什么 CSS 声明最适合消除边框?

回答by pilif

img {
    border: 0
}

Or old-fashioned:

或老式:

<img border="0" src="..." />
     ^^^^^^^^^^

回答by Kamil Zadora

Just add:

只需添加:

border: 0;

or:

或者:

a img {
  border: 0;
}

to remove border from all image links.

从所有图像链接中删除边框。

That should do the trick.

这应该够了吧。

回答by enigmatic

in the code use border=0. so for example:

在代码中使用border=0。所以例如:

<img href="mypic.gif" border="0" />

within css

在 CSS 中

border : 0;

under whatever class your image is.

无论您的形象是什么类别。

回答by George Mauer

a img {
    border-width: 0;
}

回答by George Mauer

Try this:

尝试这个:

img {
  border-style: none;
}