Inputting a default image in case the src attribute of an html

后端 未结 22 2416
渐次进展
渐次进展 2020-11-22 16:02

Is there any way to render a default image in an HTML tag, in case the src attribute is invalid (using only HTML)? If not, what would

22条回答
  •  攒了一身酷
    2020-11-22 16:22

                                                

    Use background image that let you add multiple images. My case: image1 is the main image, this will get from some place (browser doing a request) image2 is a default local image to show while image1 is being loaded. If image1 returns any kind of error, the user won't see any change and this will be clean for user experience

提交回复
热议问题