chrome/safari display border around image

后端 未结 11 894
暖寄归人
暖寄归人 2020-12-03 10:30

Chrome and Safari are displaying a border around the image, but I don\'t want one. There is no border in Mozilla. I\'ve looked through the CSS and HTML, and I can\'t find an

相关标签:
11条回答
  • 2020-12-03 11:12

    This may happen when the image is planted dynamically by css (e.g. by http://webcodertools.com/imagetobase64converter) in order to avoid extra HTTP requests. In this case we don't want to have a default image because of performance issues. I've solved it by switching from an img tag to a div tag.

    0 讨论(0)
  • 2020-12-03 11:12

    Inside img.related_photo, you need to change border: solid thin #DFDFDF; to border: 0.

    0 讨论(0)
  • 2020-12-03 11:14
    .related_photo {
       content: '';
    }
    
    0 讨论(0)
  • 2020-12-03 11:14
    img.related_photo {
      width: 80px;
      height: 60px;
      **border: solid thin #DFDFDF;** //just remove this line
      margin-right: 3px;
      float: left;
      overflow: hidden;
    }
    
    0 讨论(0)
  • 2020-12-03 11:18

    I know it is an old question. But another solution is to set the src to a 1x1 transparent pixel

    <img class="related_photo"
         src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />
    

    This works for me.

    0 讨论(0)
提交回复
热议问题