.block {
width: 120px;
height: 40px;
background: red;
position: relative;
}
.block:before {
content: '';
background: blue;
width: 100%;
height: 100%;
position: absolute;
top: 50%;
z-index: -1;
}
if ($src) {
echo '<img src="'.$src.'">';
}
img[src=""] {
display: none;
}
img:not([src]) {
display: none;
}