View Full Version : Why no header in links?
design-is
Oct 2, 2009, 01:30 PM
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
angelwatt
Oct 2, 2009, 02:11 PM
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.
design-is
Oct 2, 2009, 02:43 PM
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
angelwatt
Oct 2, 2009, 03:31 PM
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 (http://cherny.com/webdev/70/javascript-event-delegation-and-event-hanlders), 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.
design-is
Oct 2, 2009, 06:37 PM
Cool, thanks very much :)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.