Why no header in links?

Discussion in 'Web Design and Development' started by design-is, Oct 2, 2009.

  1. design-is macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #1
    Hi :)

    I know it invalidates the code, being a block inside in an inline element, but I just wanted to ask... Isn't it more symantic to put a <h3> (for example) in an <a> when its a heading than using a span to make it look like an h3?

    Isn't this therefore a justified departure from the spec? It doesn't seem to break anything.

    Been bothering me for a while...

    Cheers,

    Doug
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Having the link inside the heading tag works just as well as outside of it. The XHTML 2.0 specification (that will never come to fruition) was going to make a change to allow the href attribute to be applied to pretty much all tags, which would certainly make things easier when linking larger content areas. Unfortunately, nothing like that is in HTML5. You can achieve the same thing though using JavaScript, but that requires JavaScript.
     
  3. design-is thread starter macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #3
    Yeh, it's the applying to larger content areas part that always bugs me. I've been looking out for it being mentioned with HTML 5 but haven't come across anything yet, so am happy to assume your right there.

    Just out of interest, do you have an example of the javascript you mention?

    Thanks

    /Doug
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    The short answer is that the onclick event can be applied to anything. The longer answer involves getting to know Event Delegation, though that's not completely needed in order to get the desired outcome. I've only used it once for a quiz page, and it took a while to understand the concept along with the how and when you would apply it. It's not specifically for this situation either, but gives some insight and gives you another tool.
     
  5. design-is thread starter macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.

Share This Page