Problem Statement
Which tag is used to define individual items in both ordered and unordered lists?
Explanation
The li tag is used to define individual items in both ordered and unordered lists. The li stands for list item. Every item in a list, whether ordered or unordered, must be wrapped in an li tag. The li tag is always placed inside either a ul or ol tag. You cannot use li tags outside of a list container. Each li tag can contain text, other HTML elements like links or images, or even nested lists. The browser automatically adds the appropriate marker, either a bullet for unordered lists or a number for ordered lists. List items are block-level elements within their list container. Understanding the proper use of li tags is fundamental for creating well-structured lists in HTML.
Code Solution
SolutionRead Only
<!-- List items in unordered list --> <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> <!-- List items in ordered list --> <ol> <li>Wake up</li> <li>Brush teeth</li> <li>Have breakfast</li> </ol> <!-- List items with links --> <ul> <li><a href="home.html">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul>
