Hello!
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>
OR
<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?
Thanks
ralphm
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.)
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.