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 trialnvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsAnchor 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>
1 Answer
Alex Age
Courses Plus Student 6,387 PointsYes, 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.
nvcxnvkldsjaklfds
Courses Plus Student 5,041 Pointsnvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsAlex Age Very sorry. I do not get it.
Alex Age
Courses Plus Student 6,387 PointsAlex Age
Courses Plus Student 6,387 PointsPost updated
nvcxnvkldsjaklfds
Courses Plus Student 5,041 Pointsnvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsYou mean
html <li>
should be direct child ofhtml <ul> or <ol>
?Alex Age
Courses Plus Student 6,387 PointsAlex Age
Courses Plus Student 6,387 PointsYes, I do.
nvcxnvkldsjaklfds
Courses Plus Student 5,041 Pointsnvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsAlex Age Thank you so much for detailed explanation.
Alex Age
Courses Plus Student 6,387 PointsAlex Age
Courses Plus Student 6,387 PointsYou're welcome!