Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the margin between two images?

Tags:

html

css

I've tried to set the margin and border to 0,but still not working.

<style type="text/css">
img {margin:0;}
</style>
<body>

<img src="/static/btnNext.gif" border="0" />
<img src="/static/btnSave.gif" border="0" />

How to make two images stay close to each other?

like image 653
Mak Avatar asked Oct 29 '09 14:10

Mak


2 Answers

You can eliminate the css for the image and put the image tags on the same line with no space.

<img src="/static/btnNext.gif" border="0" /><img src="/static/btnSave.gif" border="0" />
like image 96
jay Avatar answered Sep 22 '22 01:09

jay


Comment-out the line break between them.

   <img src="/static/btnNext.gif" border="0" /><!--
--><img src="/static/btnSave.gif" border="0" />

Why? HTML allows as many spaces (both breaking and non) for code formatting, but only displays the first. In your case, the images being on different lines is being interpreted as a space between them. The simplest solution is to put them both on one line, but that isn't as readable.

like image 40
Gary Avatar answered Sep 22 '22 01:09

Gary