Forum Moderators: open
I have a random image script but when I add that to a table cell and view in IE6 it seems to add a 4 pixel space below the image. All other browsers appear ok.
Any ideas would be much appreciated?
<SCRIPT LANGUAGE="Javascript"><!--
function image() {
};
image = new image();
number = 0;
// imageArray
image[number++] = "<img src='images/1.gif' border='0'>"
image[number++] = "<img src='images/2.gif' border='0'>"
image[number++] = "<img src='images/3.gif' border='0'>"
image[number++] = "<img src='images/4.gif' border='0'>"
image[number++] = "<img src='images/5.gif' border='0'>"
// keep adding items here...
increment = Math.floor(Math.random() * number);
document.write(image[increment]);
//--></SCRIPT>
...in IE6 it seems to add a 4 pixel space below the image.
...probably because IMG's are by default inline elements and sit on the baseline of the surrounding (imaginary) text. The 4px is therefore the gap allowed for any descenders. Whether this effects other browsers may be to do with what DOCTYPE you are using.