方法
样式子元素替换
监听onerror事件
.company-logo {
position: relative;
}
.company-logo:after {
content: attr(content);
display: block;
position: absolute;
z-index: 0;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 12px;
line-height: 36px;
color: #999;
}
<img src="https://s.laoyaoba.com/node-header-logo1.png" alt content="企业简称" class="company-logo" height="36" border="0">
<img src="https://s.laoyaoba.com/node-header-logo1.png" alt content="企业简称" height="36" border="0" onerror="this.style.display=none">