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 HTML Basics Getting Started with HTML Creating Links

Ziquita Riberdy
seal-mask
.a{fill-rule:evenodd;}techdegree
Ziquita Riberdy
Front End Web Development Techdegree Student 3,137 Points

Can the anchor <a> come before the list <li>?

Hello I was wondering if the anchor could go before the list like below. It seems to work but I was wondering if it was bad practice to do so

  <h3>Top VR Resources</h3>
    <ol>
      <a href="#"><li>Learn to create educational experiences in VR</li></a>
      <a href="#"><li>Virtual Reality in Entertainment</li></a>
      <a href="#"><li>Interact with buildings and products in VR</li></a>
      <a href="#"><li>Use VR for teleconferencing and social media</li></a>
    </ol>

1 Answer

You should wrap the <li> tag around the a tag, because the only child of <ol> and <ul> should be <li>.

  <h3>Top VR Resources</h3>
    <ol>
      <li><a href="#">Learn to create educational experiences in VR</a></li>

       ...
    </ol>

See also Stackoverflow