Solved

Images with Links - Remove line break after them

Posted on 2009-05-15
5
785 Views
Last Modified: 2012-06-27
I am working on a web page that has a table at the very top with a background image (the banner). Inside the table, I have a set of PHP if statements dictating what to put in the table so that it sits on top of the banner. When the If statement displays text only, there's no white space between the banner and the top of the content (what I want). However, when the table row is the code below, there's a 3-5px gap between the bottom of the banner and the top of the content.

I would like to cut this out if at all possible.

Any ideas?
<tr>
<td align="right">
<a HREF="../main/index.php?L=en&M1=8"><img src="../images/buttons/home_off.jpg" id="home" name="home" value="home" onMouseOver= "if (document.images) document.getElementById('home').src= '../images/buttons/home_on.jpg';" onMouseOut= "if (document.images) document.getElementById('home').src= '../images/buttons/home_off.jpg';" border="0"></a>
<a HREF="../main/index.php?PrematurityNetworks_x=1"><img src="../images/buttons/networks_off.jpg" id="networks" name="networks" value="networks" onMouseOver= "if (document.images) document.getElementById('networks').src= '../images/buttons/networks_on.jpg';" onMouseOut= "if (document.images) document.getElementById('networks').src= '../images/buttons/networks_off.jpg';" border="0"></a>
<a HREF="../main/index.php?SpecialDelivery.x=55&SpecialDelivery.y=9"><img src="../images/buttons/special_off.jpg" id="special" name="special" value="special" onMouseOver= "if (document.images) document.getElementById('special').src= '../images/buttons/special_on.jpg';" onMouseOut= "if (document.images) document.getElementById('special').src= '../images/buttons/special_off.jpg';" border="0"></a>
<a HREF="../main/index.php?L=en&M1=9"><img src="../images/buttons/select_off.jpg" id="select" name="select" value="select" onMouseOver= "if (document.images) document.getElementById('select').src= '../images/buttons/select_on.jpg';" onMouseOut= "if (document.images) document.getElementById('select').src= '../images/buttons/select_off.jpg';" border="0"></a>
<a HREF="../main/index.php?Update_x=1"><img src="../images/buttons/your_off.jpg" id="your" name="your" value="your" onMouseOver= "if (document.images) document.getElementById('your').src= '../images/buttons/your_on.jpg';" onMouseOut= "if (document.images) document.getElementById('your').src= '../images/buttons/your_off.jpg';" border="0"></a>
</td>
</tr>

Open in new window

0
Comment
Question by:street9009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:cloud620
ID: 24398380
I could possibly be white space around your images causing the problem.  See my previous post about images and whitespace.  

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/HTML/Q_24410929.html

You can see if that is causing the problem by having all the images on one line without any line breaks.
0
 

Author Comment

by:street9009
ID: 24398679
It tightened it up a little in FF, but not in IE. IE's gap is still the same and the one in FF is about 1px now.
0
 
LVL 2

Expert Comment

by:cloud620
ID: 24398824
The line break between the last </a> tag and the </tr> tag is what is causing most of the space in IE for me.  I'm not saying that having everything on one line is the best solution, but it is definitely indicative of the cause.

I will look around to see if there is any way to have a browser not treat link breaks as white space.
0
 
LVL 2

Accepted Solution

by:
cloud620 earned 500 total points
ID: 24399030
There are better ways to do this that would take more time like absolute positioning, but just to get your part working, here is a workaround.

Just set the style of your table to conditionally be "margin-bottom: -2px;" if you are displaying images.(or -3, -4, etc.., whatever looks the best)

That will move the contents below it up that many pixels.

Also, make sure the cell padding and cell spacing for the table are 0, to get rid of that 1 pixel that is left, btw.  
0
 

Author Closing Comment

by:street9009
ID: 31582036
You are awesome. It worked like a champ.

Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question