loose divs and spaces also
Main Topics
Browse All TopicsI have laid out an HTML page with graphics inside table cells. One pixel height of white space is appearing (only in some browsers) under three of the images in three different cells. Sometimes when the page is refreshed the white space disappears, sometimes it doesn't. In one of the cells on the page, there are several images (displaying fine with no white space problem) that are navigation buttons that swap in another image upon mouse-over (I'm using Dreamweaver-generated JavaScript functions to do the swapping). When a mouse-over event occurs on any of these navigation button images and the new image is swapped, all of the white space under the other three "problem" images in the other table cells disappears and everything is fine.
I have seen this type of problem before (minus the behavior that fixes it on mouse-over), usually caused by line breaks or spaces in the HTML code. But, I have removed all spaces, line breaks, tabs, etc. in the HTML code between the images and table cells experiencing the problem. I have the table's cellpadding and cellspacing set to zero.
Any help would be greatly appreciated. I am at a loss on this one.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Depending on your structure
In the image code:
<img src="" style="display:block;">
In a CSS file:
img { display:block; }
Note - that will affect "all" your images, so you may want to do this:
img.special { display:block; }
and then
<img src="" class="special">
or
#special img { display:block; }
and then
<td id="special">
<img src="">
<img src="">
</td>
Please let me know if any if this is unclear,
Sean
I have tried all suggestions so far with no luck. The code is included below. The white space is appearing below the stkPhoto_marginLt_top_cana
<table width="759" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="285" valign="top">
<!-- begin table to hold top left margin image -->
<table width="285" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="284" height="328" align="left" valign="absmiddle"><img src="_images/stkPhoto_marg
<tr>
<td width="51"><a href="index.jsp"><img src="_images/navBttm_eldHo
<td height="23" valign="absmiddle"><!-- begin bottom of left margin image --><img src="_images/stkPhoto_marg
<td width="1" bgcolor="#000000"><img src="_images/_spacer.gif" width="1" height="1"></td></tr></tab
The image height that you are assigning to your images does not encompass the entire height of your cell <TD>. If you replace the following line:
<td width="284" height="328" align="left" valign="absmiddle"><img src="_images/stkPhoto_marg
with:
<td width="284" height="328" align="left" valign="absmiddle"><img src="_images/stkPhoto_marg
you will notice that the white space under the image "stkPhoto_marginLt_top_can
You might want to consider using percentages versus setting specific height and width values.
I too have had similar problems, for me it was a sort of syntactic error. Many browser correct non-perfect code and does what is intended, but some do not do this, and thus require perfectly written code. I would suggest to always have a validator present. validator.w3.org is a good one online, also make sure to check any information from mozilla javascript debuggers (they usually give CSS errors as well).
You mentioned javascript functions. Those, as you said, are very particular about line breaks. Be sure to look for those. What I would suspect more than anything is a quotation error (that is a missing quotation, or a non-escaped quotation in a javascript string).
Hope you solve it.
Ok, you need to set the valign property of the <td> tag that is under the top images. By default, most browsers will set content of a <td> to middle. Please look at the example below.
This will cause a space:
<tr>
<td><img src="whatever"></td>
</tr>
<tr>
<td><img src="whatever else"></td>
</tr>
This will not:
<tr>
<td><img src="whatever"></td>
</tr>
<tr>
<td valign="top"><img src="whatever else"></td>
</tr>
This will work for you, just try it. Have fun.
by the way, absmiddle WILL NOT remove spaces, it will cause them. just image that you have 2 picture frames 4 inches tall stacke top to bottom, and two pictures that are 2 inches tall. You want there to be no space between the images. So how are you going to align them vertically? The top image is going to be aligned bottom, or left alone. The bottom image is going to be aligned top.
The cause:
Images, Tables, and Mysterious Gaps
http://devedge.netscape.co
Solutions:
Pick a doctype that will give you almost standards mode
http://www.hut.fi/u/hsivon
Or convert images from inline to block
td img {display: block;}
Why all the tables? You don't need every row to be a separate table.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" valign="top">
<!-- begin table to hold top left margin image -->
<table width="284" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="284" height="328" colspan="2"><img src="_images/stkPhoto_marg
<tr>
<td ><a href="index.jsp"><img src="_images/navBttm_eldHo
<td ><!-- begin bottom of left margin image --><img src="_images/stkPhoto_marg
</td></tr></table>
</td>
Your code was horrible. Too many tables, no colspans, lots of unnecessary code doing weird things.
If you're using a graphic editor, don't. Learn the HTML and it will help you enormously.
I misunderstood your suggestion. I thought you were suggesting to leave the question as abandoned (i.e. unresolved) and just close it. I think that would be the best way to close this question, which is why I did not respond. I would have closed it out a while ago if I knew how to do it without accepting a comment as the answer. There's only so much time to spend on minor problems like this one. I thought I might get a quick resolution, but it did not turn out that way.
Business Accounts
Answer for Membership
by: ABaruhPosted on 2004-12-03 at 09:32:01ID: 12738195
your image alignment should use valign=absmiddle and hspace=0 and vspace=0. Try also setting the row height to the height of the image