DIV HREF in IE8

Discussion in 'HTML & Website Design' started by Omzy, Jul 14, 2009.

  1. #1
    This does not work in IE8:

    <div class="myclass"><a href="link.php"></a></div>
    Code (markup):
    Works in FF, Safari, IE7, but not IE8

    I want the whole DIV to be a link, ideally do not wish to use any JS.
     
    Omzy, Jul 14, 2009 IP
  2. aquilax

    aquilax Member

    Messages:
    126
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    33
    #2
    What's inside the anchor tag ??
     
    aquilax, Jul 14, 2009 IP
  3. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Nothing. It's meant to just make the DIV a clickable element, coz in the CSS it's:

    .myclass a {
    	display: block;
    	background-image: url(image.gif);
    	height: 71px;
    	width: 123px;
    	float: left;
    }
    
    Code (markup):
     
    Omzy, Jul 14, 2009 IP
  4. Spawny

    Spawny Well-Known Member

    Messages:
    252
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #4
    try
    <div class="myclass"><a href="link.php">&nbsp;</a></div>
    Code (markup):
     
    Spawny, Jul 14, 2009 IP
  5. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Tried that already, doesn't work...
     
    Omzy, Jul 14, 2009 IP
  6. aquilax

    aquilax Member

    Messages:
    126
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    33
    #6
    Use transparent gif inside the anchor.
     
    aquilax, Jul 14, 2009 IP
  7. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Basically the background image gets displayed, so I know it's reading the CSS correctly. The only thing that does not work is that the div is not a hyperlink.

    Also I have an a:hover css property which is supposed to change the image when you hover over the link, this again works in FF/IE7 but just not IE8 for some strange reason...
     
    Omzy, Jul 14, 2009 IP
  8. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Anyone? Why would it be that it works in all other browsers but not IE8?
     
    Omzy, Jul 14, 2009 IP
  9. GoldenGrahams

    GoldenGrahams Active Member

    Messages:
    137
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #9
    I had the same problem, a javascript onclick fixed it, not great but its a work around
     
    GoldenGrahams, Jul 14, 2009 IP
  10. Omzy

    Omzy Peon

    Messages:
    249
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Seems like this is a major bug in IE8, I applied a basic onmouseover action to the div and it doesn't do anything...
     
    Omzy, Jul 14, 2009 IP
  11. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I doubt this would be a bug, probably working as intended and being fussy with the fact that it's being changed to a block element. You'll probably need some sort of hack. Try playing around with the display value and possibly the floating.
     
    garrettheel, Jul 14, 2009 IP