Styling Broken Images

by Ting-Yuan Chang

HTML

<img src='http://i.imgur.com/nPcXuYs1.jpgs' alt='abc'>

CSS

img {  
  /* Same as first example */
  min-height: 50px; width: 300px;
  height: 300px;
  position: absolute;
}

img:before {  
  content: " ";
  display: block;

  position: absolute;
  top:  0px;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgb(230, 230, 230);
  border: 2px dotted rgb(200, 200, 200);
  border-radius: 5px;
}

img:after {  
  content: "Image not found";
  display: block;
  font-size: 16px;
  font-style: normal;
  color: rgb(100, 100, 100);

  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  text-align: center;
  transform: translate(0%,-50%);
}