Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

trio-group I.AM
trio-group I.AM
23,591 Points

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