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!
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
Anchor element inside inside element
In this exercise, I see Mr. Nick put anchor element inside list element. Is there any semantic meaning to it?
Here is the code
<nav> <ul> <!--anchor element is a child to list element here.--> <li><a href="index.html">Projects</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> <ul> </nav>
It seems wrapping list element with anchor element have the same result.
<nav> <ul> <!--list element is a child to anchor element here.--> <a href="index.html"><li>Projects</li></a> <a href="about.html"><li>About</li></a> <a href="contact.html"><li>Contact</li></a> <ul> </nav>
Yes, it is semantic becouse
<li> have to be a direct child of a
<ul> (unordered) or
<ol> (ordered list) and
<a> creates the navigation meaning you can click on a link and go to another page.