Null problem of HTML img

Let the boss take a look. What I want to ask is, can I set the default style of the damaged image when img is empty?

Feb.28,2021

img can have onerror events
vue

<img src="a.gif" onerror='this.src="default.gif" />
$('img').error(function(){
    $(this).attr('src',"default.gif");
})

if you have to use the img tag, the onerror event will trigger the onerror event if an error occurs during the loading of the image. You can use a transparent picture to display it, and then your background can overwrite

.

Why don't you consider using background for all other tags



<img src="" alt="" style="height: 100px;width: 100px; display: inline-block;">

got the answer. Thank you

Menu