Can the <li> element contain content other than text?



Can the <li> element contain content other than text? For example, can we have lists of videos or songs or hyperlinks or some combination of all three?


Yes we can! The <li> element can contain any element which is valid within the <body> tag. This means that we can have lists of videos, images, songs, hyperlinks, or any combination thereof. In fact, we can even have lists of lists!

FAQ: Learn HTML Elements - Intro to HTML - Ordered Lists

Wow! I didn’t know the li element is so versatile.


yes, MDN always has good documentation so for example about <li>:

we can see: permitted content flow content, then you can see what tags are flow content. Which are a lot


You can create an unordered list containing an ordered referencing an image of an ordered list containing an unordered list.


If this is possible then, does that mean the li element will contain attributes representing the song or image within its tag, or instead place the song or image contents outside its tag?