CSS: Remove Whitespace Between Images (Cascading Style Sheets)

This article is all about having images display without any white space between them. By default, images are displayed as inline elements. By setting them to block elements it will remove the space between them and put them on their own line. Then, setting their margin to margin: 0 auto; will center them, a useful technique for writing responsive CSS code.

Another solution is to float: left; (or right) the images but be sure to add a <div style="clear:both;"></div> or some "clear fix" equivalent to prevent wrapping of item around the images.

Feedback
close