How do I link a div

airbornflghtairbornflght Houston, TX Icrontian
edited April 2009 in Internet & Media
I'm aware that it's not kosher to do so, but I need to.

If you look here, on the left side of the page you will see three boxes. I want each box to be linked, not just the title.

I've looked online and of the two solutions I found one was javascript, which I don't want to use, and the other was css, which didn't work.

How can I do this and retain functionality?

Comments

  • LincLinc Owner Detroit Icrontian
    edited March 2009
    You can't link a div under HTML4 or XHTML1. Currently, only the anchor tag allows the href element (well, maybe one or two other obscure ones I'm forgetting too).

    You could wrap an 'a' tag around the div (probably won't validate). Or, you could absolute-position a clear linked gif over the boxes (ick). Or, you could just link everything in the div (meh). Or, you could make the entire box an image, link the image, and assign the text as its' alt text (probably what I would do).
  • LincLinc Owner Detroit Icrontian
    edited March 2009
    That's a super-sexy theme, btw. Did you do that?
  • airbornflghtairbornflght Houston, TX Icrontian
    edited April 2009
    I wish. I found a template and modified the hell out of it in photoshop. I'm calling it a remix. I've still got some remixing to do I think.

    I could never find the creative talent to make something from scratch. I'm a typesetter, not an artist :D

    I'm pretty bummed out about not being able to size the href to encompass the entire div. That would be so awesome. I'm thinking of the transparent gif route, but that's kind of jerry-rigged. You would think a situation like this would be provided for.
  • LincLinc Owner Detroit Icrontian
    edited April 2009
    You could put it all in a span, which are legal in an anchor.

    Remember, an HTML element doesn't necessary look like anything in particular. :) If you really want to go nuts, you can do whatever is necessary to make it work in browsers, semantics be damned. (There, I said it!) Heck, you could make the strong tag display:block and dump the entire contents in that ;D Just test the crap out of it.

    Related reading: http://meyerweb.com/eric/html-xhtml/html5-linking.html
Sign In or Register to comment.