tags:

views:

79

answers:

3

This code below works perfectly for all browsers except IE 7 or 8.

<img src="images/image1.png" usemap="#map1" width="669" height="300" border="0">    
<map name="map1">    
  <area shape="rect" coords="80,120,182,226" href="XXXXX" target="_top" >    
</map>    
<div style="background : url(images/image2.png) repeat-y; height:auto; width:669px;">    

<?
if ($count==0)
{
?>

table width="550">    
tr>                     
td>    
div >    
center>    
    Sorry there is not information right now to show. <br/>    
Please <a href="" target="_top">click here</a> to go to our home page.<center>     
/div>    
/td>    
/tr>    
/table>    
?
}  
else {}
/div>
img src="images/image3.png" width="669" >

in the CSS: td { vertical-align: top; }

The problem in IE is that after image1.png i can a white space in between and the next image, image2.png is being shown after the blank white space. you can paste this code and check it yourself. I am not able to figure out why this is happening?

is there anyway where i can check if the browser is IE and if so, then push image2.png little upwards so that the blank space is covered? any suggestions?

Additional Info:
I do have another image, image3.png, but this image is not showing any blank spaces on loading.

I tried to use jpg images but still the same.

A: 

try a negative margin-top?

Brad
that is what i intended to do but how can i check if the browser is only IE and only for IE do this negative margin-top?
Scorpion King
@Scorpion Awww, better find out what the problem is and fix that instead. Can you post a live link?
Pekka
i cannot provide a live link now but the code pretty much sums it up.
Scorpion King
A: 

The problem in IE is that after image1.png i can a white space in between and the next image

It could be that IE reserves space for the <map> element. Try placing the element elsewhere, it can be anywhere in the <body>.

Pekka
I placed `<map>` just before the `</body>` line but still no change :(
Scorpion King
@Scorpion what happens if you remove the map altogether?
Pekka
i did that.. no use. the problem looks like is coming from div for image 2. i need to use this background image and the image needs to be repeated in y axis. CORRECTION: the problem is coming with `<img>` tag. I used 3 image tags, removed the divs, and for all the 3 i had blank spaces...?!?!?!?
Scorpion King
@Scorpion please show the full code. What does it say in "have some code here"?
Pekka
@Scorpion try what @Ope says (I can't imagine that is the problem, but it sounds sensible.) if that doesn't work, you'll have to show a live example
Pekka
A: 

Your IMG is an inline element and is implicitly inside a block. This block also contains some "text": the whitespace before the the DIV. Default vertical-align for the image is "baseline", so the whitespace that you see is the space under the baseline of text (the space where e.g. the the lower circle in letter "g" is).

To fix this, you have at least these options:

  • Remove all whitespace between IMG and DIV (and perhaps put IMG within its own DIV)
  • Set the style="vertical-align: bottom" on the IMG
Ope
using a div has solved the problem but how can i use `usemap` inside the div? this is my code right now: `<div style="background : url(images/image1.png) height:340; width:669px;"></div>` . How can i usemap in the div style?
Scorpion King
I don't think you can... But I was not suggesting to switch IMG to DIV, but to put IMG inside a DIV: "<DIV><IMG /></DIV>". Then just make sure there is no whitespace inside the DIV, only the IMG tag and make sure all paddings, borders and margins are 0px.
Ope
even when i used <DIV><IMG /></DIV> i got the white space problem. so what i did is i used a background image for div, then used the image along with usemap and closed the div which eliminated the white space due to the background image. now white space is gone, image is there and so is the usemap. Thanks for the tip mate :)
Scorpion King