Q: Linking to the Same Page and Unordered List


#1

Hello, I’m working on an exercise where the course is asking me to make a href="#linklocation" on li elements inside an unordered list. I wrote the anchor tags outside of li but was prompted to write them inside li tags, only around the raw text. Why can’t I wrap the li tags as well?

(it’s my first post question, sorry if it’s in the wrong place!)


#2

We cannot write HTML inside an element attribute. LI is not part of the content, but the structure.

<li><a href="#">link text</a></li>

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.