Html 如何去除超链接图像的边框?

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

how to remove border of a hyper-link image?

htmlhyperlink

提问by nectar

<li><a href="#" ><img src="images/hospitality.png" title="" /></a>

Problem- image is getting displayed inside a blue rectangle box in IE and Mozilla but not in Chrome.How can I remove that blue box from IE also?

问题 - 图像在 IE 和 Mozilla 中显示在蓝色矩形框内,但在 Chrome 中不显示。如何从 IE 中删除该蓝色框?

回答by Douwe Maan

You can set this CSS to remove the blue border on every image within a link:

您可以设置此 CSS 以删除链接中每个图像上的蓝色边框:

a img {
    border: 0;
}

回答by Alex

Or add it inline to the img element:

或者将其内联添加到 img 元素:

<li>
    <a href="#">
        <img style="border: 0;" src="images/hospitality.png" title="" />
    </a>
</li>

回答by MA9H

The "border=0" solution works, but it is not very easy to implement since it requires its addition in every and each link image you put in your project.

“border=0”解决方案有效,但实施起来并不容易,因为它需要在您放入项目的每个链接图像中添加它。

The better solution is to include the following tag within your page's <head>...</head>tags, which can be in a master page so that all the inner pages will inherent it from the master page

更好的解决方案是在页面的<head>...</head>标签中包含以下标签,该标签可以位于母版页中,以便所有内页都从母版页中继承它

<style type="text/css">
    <!--
    img { border: none; }
    -->
</style>

回答by MA9H

external css

外部CSS

img {border : 0;}
img a {outline : none;}

internal css

内部CSS

<style type="text/css">
  img { border: none; }
</style>

inline css

内联 css

<img src="logo.png" style="border-style: none"/>

回答by Neda Rezaei

For removing this border you should set border to none.

要删除此边框,您应该将边框设置为无。

  a img 
        {
        border:none;
        }