Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

design-is

macrumors 65816
Original poster
Oct 17, 2007
1,219
1
London / U.K.
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
 
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.
 
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
 
Just out of interest, do you have an example of the javascript you mention?

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.