如何加载没有边框的背景图像



我必须在锚标签中加载图像。

<a> <img calss="imageclass"/></a> 

如果像这样加载,我会在图像周围获得边框。我已经尝试了诸如border:0和border-style:none 之类的所有内容,但没有任何效果。

我有一个解决方案,如果我使用div 元素而不是 img,它没有任何边框。

请帮助我如何在没有边框且不使用div 元素的情况下加载此图像。

在你的 css 中试试这个:

a, img {
  border: 0 none;
}

JSFIddle.在这里

<a href="https://www.google.com" style="border: none;"><img src="http://i.imgur.com/PWSOy.jpg" /></a>

通过 css 代码上传您的图像...喜欢这个

#bgimg { background: url("http://www.staticimages.co/seemeagain/upgrade-sprite.png") -35px -3px; display:block;width: 25px;height: 25px;float: left; } and stop using img tag for uploading background image , use span tag and call your bgimg tag inside there .

最新更新