-1

I want to create image with the border in opposite corners (using :: after and :: before). I almost got it, BUT the image doesn't cover the whole space in the div. Below the image there is some empty space (marked red in jsfiddle), and I don't understand what is the reason. The most important thing is that the image's height change the width. Could you explain me what I did wrong? :)

This is my code: https://jsfiddle.net/ndy79hvo/1/

Johannes
  • 59,058
  • 16
  • 59
  • 114
sqtr
  • 160
  • 1
  • 11

1 Answers1

1

This is due to the default baseline vertical alignment for images, which leaves some empty space below that baseline (where the descenders of letters like j, p, y would go). Add display: block; to the CSS rule for your image to change this.

https://jsfiddle.net/tpqzr3w2/

Johannes
  • 59,058
  • 16
  • 59
  • 114