lampcms_com — 2009-11-16T19:20:29-05:00 — #1
Which one is correct way to make title of the link to also be an H3 tag:
Do I nest the A inside the H3 OR H3 inside the A:
<h3><a href="/somwhere.htm">Some title</a></h3>
<a href="/somewhere.htm"><h3>Some title</h3></a>
Just wondering if these 2 are both correct or if only one is correct, then which one and why?
ralphm — 2009-11-16T19:37:51-05:00 — #2
You must nest the <a> inside the <h3>. The rule is that inline elements (like <a> elements) cannot contain block-level elements (like <h3>s).
(Block-level elements by default take up a line of their own and stack one atop another, while inline elements sit side by side by default.)
alexmwalker — 2009-11-16T19:38:26-05:00 — #3
Definitely the first. <h3>s are designed to be 'block level' tags and provide fundamental structure to your document.
<a>s are inline tags, and are designed to sit inside like that structure in the same way <strong>, <em> and <code> do.