table td a img visible difference Firefox vs. IE

They have: 2 posts

Joined: Mar 2010

I have made a table a very simple table (only 1 column) with a hyper-link and a small image (logo). The image is also the link.
Please see code below:

  </head>
  <body>
    <table>
      <tr><td><a href="test.php">test<img src="images/logo_ns.gif"></a></td></tr>
    </table>
  </body>
</html>

Now with CSS I want the link on the left side and the image on the right side of the column.
I used a float: right; for the image. Please see the CSS code below.
In Firefox this looks very good, in IE the image is on the right (good!) but also moved below the link (not good) ?!?! All must be on the same line. How to prevent IE doing this? Is this possbile without using 2 cells?

table {
  color: black;
  background: white;
  border: 3px solid #696969;
  border-collapse: collapse;
  margin: 5px 8px 5px 8px;
}

table td {
  width: 200px;
  padding-left: 6px;
}

table a {
  text-align: left;
}

table a img {
  text-decoration: none;
  float: right;
  margin: 4px 1px 0;
}

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

If I remember right, for best results using a float that way, what you are floating should be inside another element that is floated too.

I could be wrong though, but worth a try.

-Greg

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Try putting the image before the text. If I understand correctly, IE's might actually be the correct behaviour.

They have: 2 posts

Joined: Mar 2010

Thanks for the fast responses!

Megan wrote:
Try putting the image before the text. If I understand correctly, IE's might actually be the correct behaviour.

It works!!!! Many thanks , you r the best!!!

I tried so much things nothing seemed to work, I 'm very happy now!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.