0

Nesting of HTML elements

What is the difference between nesting list elements in anchor tag and nesting anchor tag in list element

22nd Dec 2019, 11:27 AM
lavanya kumari
lavanya kumari - avatar
2 Réponses
+ 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.
22nd Dec 2019, 3:13 PM
Edwin Pratt
Edwin Pratt - avatar
+ 1
Thanks a lot Edwin for elobarate explanation
23rd Dec 2019, 9:12 AM
lavanya kumari
lavanya kumari - avatar