Simple HTML question

  • Thread starter Thread starter Lei Wu
  • Start date Start date
L

Lei Wu

Hi, guys,

As an Internet developer for many years, I thought I knew HTML...
until I came across this:

The following two tables look different in IE 6.0. I've pinpointed the
cause -- the hard return between the <img> tag and the </td> tag. I
thought hard returns don't make a differnt unless in <pre> tags, but
apparently I was wrong.

<table cellpadding="0" cellspacing="0" border="1">
<tr>
<td>
<img src="http://www.ccnmatthews.com/images/red_dot.gif"
height="6" width="10" border="0">
</td>
</tr>
</table>

<p>&nbsp;</p>

<table cellspacing="0" cellpadding="0" border="1" >
<tr>
<td>
<img src="http://www.ccnmatthews.com/images/red_dot.gif" height="6"
width="10" border="0"></td>
</tr>
</table>

My problem is, because my HTML is generated from Xsl.XslTransform,
there are hard returns after the image tag within the table cell. But
I want it to look like the second table.

Can somebody help me out? Thank you.

By the way, Netscape 7.01 gives the same result. However, in Opera
7.23 the two tables look the same, which is my desired result.

Lei
 
Try removing the hard return. You might also set the image to display:block;
to try getting rid of anyother whitespace that doesnt. Certain whitepsace is
"supposed" to be there because images are inline-block by default iirc. Its
explained on the w3c in some abnormal inhumane way
 
Setting img to display:block works. Thanks a lot!

I could return the hard returns, but display:block is definitely much more elegant.

Lei
 
Back
Top