treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Link problem in IE6

  • Hi, I'm having a hard time with ie6 lately on a particular problem, here's the bit of html I'm on :


    <a href=\"\" style=\"display:block;width:200px;height:200px;\">
    <span style=\"display:block;width:100px;height:100px;\">
    <img src=\"img.jpg\" alt=\"\" />
    </span>
    </a>


    Everything is fine with firefox etc, but the link won't work by clicking directly on the image on IE6 (but will do work anywhere else on the <a>).

    Someone has an idea ?

    Thanks !

    edit : This does not work on IE7 either
  • Is that your exact code?

    You don't have anything in the href="" which will stop it from being clickable.
  • Sorry I should have mentioned this is just a demo, I have a real link on my html page.

    Here is a link of a demo page:
    http://www.daniel-rico.com/demos/ie/
  • That's wack man. As I'm sure you noticed, in IE6, the <a> is still clickable; but the span and img are not. if you remove the span, is the image clickable?
  • Start by adding a doctype to your page. IE6 is stupid and will go wonky and behave funny without proper instructions. http://www.alistapart.com/articles/doctype/

    Next, I agree with Ashton... remove the span.

    If you can't do that, try adding display:inline to the image.