Simple HTML question

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
 
G

Guest

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
 
L

Lei Wu

Setting img to display:block works. Thanks a lot!

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

Lei
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top