<img> inside <a> gets blue border

风格不统一 提交于 2019-12-18 18:37:07

问题


<a href="index.html"><img src="image.png"/></a>

IE8 highlights the image with a blue border. I'm not sure what CSS is relevant here, is it just border? Can I use a single CSS style to turn it off, like:

a img {
  ...
}

回答1:


Use this css:

a img {
 border:none;
}



回答2:


Yes, you can:

a img { border: 0; }

You can use 0 for 0px width, or none for no border overall, same effect...they both work cross-browser.




回答3:


a img{
    border-width: 0;
}

Find further reference at https://developer.mozilla.org/en/CSS/border

I suggest you test your site in other browsers. In this case, you would have noticed that it's not an IE8 issue.




回答4:


Have you tried setting the image border to 0?




回答5:


You can also use this

<img height="20px" border="0" src="image.png" />

However Sarfaraz' answer above is a better approach.



来源:https://stackoverflow.com/questions/2922858/img-inside-a-gets-blue-border

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!