<li>
Published Jul 1, 2022
Contribute to Docs
The <li>
element represents a single list item. This element must be wrapped in an <ol>
, <ul>
, or <menu>
element.
Syntax
<li>Text for list item</li>
Content is required to be between the opening and closing <li>
tags. It can hold any valid HTML, and each <li>
element will be indented and preceded either with a number (for ordered lists), or a dot (for unordered lists and menus).
Example
<!DOCTYPE html><html><head> </head><body><h3>My Favorite Things</h3><ul><li>Rain drops on roses</li><li>Whiskers on kittens</li><li>Bright copper kettles</li><li>Warm woolen mittens</li></ul><h3>To-do List</h3><ol><li>Make bed</li><li>Brush teeth</li><li>Have breakfast</li><li>Continue learning HTML</li></ol></body></html>
This will output the following;
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn HTML on Codecademy
- Career path
Front-End Engineer
Front-end engineers work closely with designers to make websites beautiful, functional, and fast.Includes 34 CoursesWith Professional CertificationBeginner Friendly115 hours - Free course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner Friendly7 hours