Question

White Space Under Images in Table Cell - Problem Disappears on Mouse-Over of Unrelated Images

Asked by: lrich15

I 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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-12-03 at 08:47:15ID21229410
Tags

dreamweaver

,

minus

,

table

,

under

Topic

Hypertext Markup Language (HTML)

Participating Experts
10
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Pixel problem !!
    Hi, I just developed and launched a homepage of mine and I developed that homepage using frontpage '98 and I am working on 640 x 480 pixels. But when the other users accessed my homepage they complained me for the disturbed text on my homepage I mean the aligment was totally...
  2. Exactly 1 pixel colored border around cells in a table
    Hi, I am trying to create a table with a 1 pixel border. What is happening, is that the 1 pixel is being drawn around all of the cells, but this means that if 2 adjacent cells have the 1px border, it becomes 2 pixels where they share an edge. So this happens with the entir...
  3. CSS border and cellspacing
    Hi The following situation: <table cellpadding=0 cellspacing=0> <tr><td>text</td><td>spacerGif</td><td>text</td><td>text</td> </table> I have defined a style with border-left, right, top, for ea...
  4. Cellspacing
    How do you write up cellspacing and cellpadding in CSS ? For a table.....
  5. cell width problem in dreamweaver
    I am using dreamweaver mx to build a website. I'd like some of the columns in my table to be 3 pixels wide, but for some reason I don't seem to be able to make them to be under 3: Here's some simplified code to HTML to explain: <html> <head> <title>U...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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

 

by: masirofPosted on 2004-12-03 at 10:29:15ID: 12738781

loose divs and spaces also

 

by: webwomanPosted on 2004-12-03 at 12:46:37ID: 12740053

Seeing code or a link to the page would be helpful.

 

by: seanpowellPosted on 2004-12-03 at 13:04:14ID: 12740200

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

 

by: lrich15Posted on 2004-12-03 at 13:55:24ID: 12740677

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_canadianDO.jpg image and the stkPhoto_marginLt_bottom_canadianDO.jpg image.  Another thing I noticed...sometimes when I hit the Alt key, the lines disappear.  Also, if I open another window (of any program) on top of the browser window and then bring the browser window back to the front, the lines are gone.


<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_marginLt_top_canadianDO.jpg" border="0" width="284" height="328" hspace="0" vspace="0" style="display:block;"></td><td width="1" bgcolor="#000000"><img src="_images/_spacer.gif" width="1" height="328"></td></tr></table><table width="285" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="51"><a href="index.jsp"><img src="_images/navBttm_eldHome.gif" width="51" height="23" border="0"></a></td>
          <td height="23" valign="absmiddle"><!-- begin bottom of left margin image --><img src="_images/stkPhoto_marginLt_bottom_canadianDO.jpg" width="233" height="23" hspace="0" vspace="0" border="0" style="display:block;"></td>
          <td width="1" bgcolor="#000000"><img src="_images/_spacer.gif" width="1" height="1"></td></tr></table>

 

by: losylos465Posted on 2004-12-03 at 14:25:14ID: 12740952

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_marginLt_top_canadianDO.jpg" border="0" width="284" height="328" hspace="0" vspace="0" style="display:block;">

with:

<td width="284" height="328" align="left" valign="absmiddle"><img src="_images/stkPhoto_marginLt_top_canadianDO.jpg" border="0" width="284" height="332" hspace="0" vspace="0" style="display:block;">

you will notice that the white space under the image "stkPhoto_marginLt_top_canadianDO.jpg" has disappeared.

You might want to consider using percentages versus setting specific height and width values.

 

by: sdaoudPosted on 2004-12-03 at 16:27:29ID: 12741609

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.

 

by: prodesign777Posted on 2004-12-03 at 22:58:22ID: 12742578

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: prodesign777Posted on 2004-12-03 at 23:03:33ID: 12742592

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.

 

by: pmsyyzPosted on 2004-12-04 at 22:17:56ID: 12746998

The cause:

Images, Tables, and Mysterious Gaps
http://devedge.netscape.com/viewsource/2002/img-table/

Solutions:

Pick a doctype that will give you almost standards mode
http://www.hut.fi/u/hsivonen/doctype.html

Or convert images from inline to block
td img {display: block;}

 

by: aaaaaaPosted on 2004-12-06 at 03:34:10ID: 12753015

<img BORDER ="0" src="urimage.gif" >

 

by: webwomanPosted on 2004-12-08 at 02:53:31ID: 12772089

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_marginLt_top_canadianDO.jpg" border="0" width="284" height="328" ></td></tr>
<tr>
          <td ><a href="index.jsp"><img src="_images/navBttm_eldHome.gif" width="51" height="23" border="0"></a></td>
          <td ><!-- begin bottom of left margin image --><img src="_images/stkPhoto_marginLt_bottom_canadianDO.jpg" width="233" height="23" border="0" ></td>
          </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.

 

by: carrzkissPosted on 2004-12-09 at 21:37:29ID: 12790037

If you can provide a LIVE link to your page in question, I should be able to assist.
As I helped another person with their same issue a while back.
But I need to see the page, so that it can be downloaded and viewed off line.

Carrzkiss

 

by: lrich15Posted on 2005-03-22 at 07:31:09ID: 13602048

How can an accepted answer be forced?  None of the comments actually provided a solution to the problem.  Forcing accepted answers compromises the validity of this forum.  Better to close this one out and mark it as unresolved.

 

by: lrich15Posted on 2005-03-22 at 14:36:07ID: 13606467

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.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...