Jump to content

IE and space between images

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I'm creating a menu bar, I can show it correctly one any browser but IE7 and 8.

The code is
<img src="images/sp_left.gif" alt="left" style="float:left;" />
<a href="#">
    <img src="images/btn_01.gif" alt="btn01" style="float:left;"/>
</a>
<img src="images/sp_01.gif" alt="sp01" style="float:left;"/>
<a href="#">
    <img src="images/btn_02.gif" alt="btn02" style="float:left;"/>
</a>
<img src="images/sp_02.gif" alt="sp02" style="float:left;"/>
<a href="#">
    <img src="images/btn_03.gif" alt="btn03" style="float:left;" />
</a>
<img src="images/sp_03.gif" alt="sp03" style="float:left;"/>
<a href="#">
    <img src="images/btn_04.gif" alt="btn04" style="float:left;"/>
</a>
<img src="images/sp_04.gif" alt="sp04" style="float:left;"/>
<a href="#" ">
    <img src="images/btn_05.gif" alt="btn05" style="float:left;"/>
</a>
<img src="images/sp_06.gif" alt="sp06" style="float:left;"/>
<a href="#" ">
    <img src="images/btn_06.gif" alt="btn06" style="float:left;"/>
</a>
<img src="images/sp_07.gif" alt="sp07" style="float:left;"/>
<a href="#" ">
    <img src="images/btn_07.gif" alt="btn07" style="float:left;"/>
</a>
<img src="images/sp_right.gif" alt="right" style="float:left;"/>
And this is a piece of CSS code
a {
    outline:none;
    text-decoration:none;
    margin:0;
}

img {
    border:none;
    margin:0;
}
This is the result on Firefox, Opera, Safari and Chrome
Posted Image

And this is the result on IE 7 and 8
Posted Image

How do I remove the space between the images on IE?

#2
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
Solved, I've added some rules for IE only which give a negative margin to images.

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
I think you should reset all the margins and padding to zero, different browsers have defaults, setting them to zero will make it a bit more compatible rather than negative margins or other hacks.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users