Downside of "display: block" for images?

Baumr picture Baumr · Oct 30, 2012 · Viewed 21.2k times · Source

Is there any downside to converting img from inline-block elements into block objects with the display: block CSS property?

Most of the time, I want them to be block elements. Any useful inline aspects that I am losing? (Perhaps I am not seeing some as useful?)

Should all images be converted into block elements by default? Why are they inline-block elements according to spec?

P.S. I am asking this with considerations for layout via positioning & floats, and surrounding elements.

Answer

David Nguyen picture David Nguyen · Oct 31, 2012

Well considering that a block will force anything after to line break, there is only one scenario where it would be bad:

If you plan to have another inline element (text, another image, span, etc) beside it