Removing the image border in Chrome/IE9

后端 未结 18 2122
长情又很酷
长情又很酷 2020-11-27 04:28

I am trying to get rid of the thin border that appears for every image in Chrome & IE9. I have this CSS:

outline: none;
border: none;

U

18条回答
  •  失恋的感觉
    2020-11-27 05:07

    If you are trying to fix the Chrome Bug on loading images, but you ALSO want your placeholder image to load use (with Lazy Loading images, for example) use can do this trick:

    .container { overflow: hidden; height: 200px; width: 200px }
    
    .container img { width: 100%; height: 100% }
    
    .container img[src=''],
    .container img:not([src]) {
      width: 102%;
      height: 102%;
      margin: -1%;
    }
    

    This will make the border be hidden in the container's overflow and you won't see it.

    Turn this:

    Into this:

提交回复
热议问题