Edit in JSFiddle

<div>
  <span>
    <img src="https://demo.cssworld.cn/images/common/m/1.jpg"/>  
  </span>x
</div>
div {
  width: 200px;
  line-height: 170px;
  background-color: #ccc;
  position: relative;
  font-size: 40px;
}
div:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-bottom: solid 1px #0000ff;
}
span {
  display: inline-block;
  width: 80%;
  line-height: 0;
  position: relative;
}
span:after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-bottom: solid 1px #ff0000;
}
img {
  width: 100%;
  vertical-align: middle;
  
}