Removing Spaces Between Images in HTML

When using images in HTML you might want to remove the white spaces in between. There are two things you should be aware of when using images.

First thing is to make sure there is no spaces between the <img> tags. Like in this example there is an unwanted gap between image1 and 2:

<img src="img1.gif"/> <img src="img2.gif"/>

Second thing to be aware of when trying to removed the spaces between images in HTML is to placed the images inside a <div> with the css style line-height set to zero.

<!DOCTYPE HTML>
<html>
<head>
 <title>Image example</title>
 <!--CSS-->
 <style type="text/css">
 .nospace {
 line-height:0;
 }
 </style>
</head>
<body>
 <div class="nospace">
 <img src="img1.gif"/><img src="img2.gif"
 </div>
</body>
</html>
Posted in Tips and Tricks Tagged with: , , , ,