Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website Creating HTML Content Use the Navigation Element

Adam Dingle
Adam Dingle
5,582 Points

Anchor Tags

I noticed that when we first used anchor tags they were entered outside the <h1> tags, but in the list they were included inside the <li> tags. Is there a reason for this or can they be used either way?

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Inside list element is best practice as it's inside a list item that you'd put your link and its text.

So this is best practice.

<ul>
   <li><a href="#">Link text</a></li>
</ul>

But this is also best practice.

<a href = "#"><img src = ""></a>
Lady Do While
Lady Do While
6,027 Points

Yes, the video doesn't reflect best practice as it wraps two heading elements (block elements) in an anchor (in-line). I am using this video for review and that was difficult to watch.