Link to home
Start Free TrialLog in
Avatar of lucasbickel
lucasbickel

asked on

image in form

I have a gif image witch is 483*190 Pixel. I would now like it to fit into a table like this:
<table border=0 cellpadding=0 cellspacing=0>
<tr><td>
<img src="images/myimg.gif" border=0>
</td></tr>
</table>
In Netscape (4.5) the image just won't fit in:-( Theres a space about 3-5 Pixels large at the bottom of the image! I can't have that space because i need a seemless page. I tried Opera and IE and IE was the only browser to do this correctly.
Avatar of siabod
siabod

Why don't you give a height to the image then ? 483*187 ?

Avatar of lucasbickel

ASKER

The image once had a height of 184 I the made it 190 because I thought that I could make it work with a other number. I also tried setting the hight attribute of the Table-delimiter to the height of the image, but that didn't work to.


What else is in the table?  If you are trying to get two images to blend seamlessly in two rows of a table, you will probably not be able to do it in NS.  There are a couple of places where NS insists on a small border space, and I believe table cells is one of them.

Tom
you'd probably also like to make sure there's no whitespace between the table start- and end-tags and the image tag.  like this:

<td><img
src="images/myimage.gif"
border="0"></td>
you can also give a HEIGHT and WIDTH for the table..
take out the line feeds.

<table border=0 cellpadding=0 cellspacing=0>
<tr><td><img src="images/myimg.gif" border=0></td></tr>
</table>  


it worked for me.... :>
Taking out the line-feeds does work! I would like a solution that makes the code look more legant but this way will do, thanks alot. Does anybody now why this is happening?
It's because of the brower's way of dealing with whitespace.

whitespace really doesn't matter much unless there's some actual content in the element that you're concerned about.  in your code you have this:

<td><img src=" ... "></td>

if you write the code like I did, without any line breaks (easy when you have an editor that wraps lines for you automagically) there will not be any whitespace in the _content_ of the table cell element (TD).  that in turn means that the browser will not show any spacing.

but if you do it like this:

<td>
<img src=" ... ">
</td>

what you're actually saying is that the content of the table cell is:

<td> <img src=" ... "> </td>

because the line feeds (/CR) in your document converts to single spaces.  so, the browser puts those single spaces into the document when it's rendered, and the image shows up with some space around it.  it's a common problem when you're used to putting in line-breaks in your code to make it easy to read. :)

so, who gets the points?
To me it seems, that you (nettrom) came up first with the solution so i think that you deserve the points.

ASKER CERTIFIED SOLUTION
Avatar of nettrom
nettrom

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial