0
Nesting of HTML elements
What is the difference between nesting list elements in anchor tag and nesting anchor tag in list element
2 Antworten
+ 2
Anchor tags *in* list elements can be used to redirect to different pages depending on which item you tapped. For example:
```
<ul>
<li><a href="/home">Home</a></li>
<li><a href="/about"></a></li>
</ul>
```
Whereas, a list in an anchor tag can be used to link to only one page.
```
<a href="/view-full-list">
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</a>
```
TL;DR, <a> in <li> tags can be used to redirect the user to different pages depending on item. List in <a> can only redirect to one page.
+ 1
Thanks a lot Edwin for elobarate explanation