开发者

<img> inside <a> gets blue border

开发者 https://www.devze.com 2023-01-01 11:52 出处:网络
<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
<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 开发者_Python百科img {
  ...
}


Use this css:

a img {
 border:none;
}


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.


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.


Have you tried setting the image border to 0?


You can also use this

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

However Sarfaraz' answer above is a better approach.

0

精彩评论

暂无评论...
验证码 换一张
取 消