▲Wirig Diagram Hot
▲ ▲ ▼

Understanding LI in HTML: Examples & Definitions

By

Ever delved into HTML and wondered what the seemingly innocuous `li` tag does? It's one of the building blocks of ordered and unordered lists, a cornerstone of creating intuitive and structured web content.

Understanding the `li` Tag

At its core, the `li` tag is used to create a single item in an unordered or ordered HTML list.

HTML Input Types You Must Remember 📌
HTML Input Types You Must Remember 📌
What is the Difference Between HTML and XML
What is the Difference Between HTML and XML
an image of a web page with the text'html input types'on it
an image of a web page with the text'html input types'on it

The `li` tag is a container for an item - in a shopping list, a list of points, or any other collection of related elements you'd like to display on your webpage.

Structure of an `li` Tag

The `li` tag is opening and self-closing, often omitting the closing tag (though not required in HTML5). For example:

an image of what are attributes in html?
an image of what are attributes in html?
What Is HTML? 💻 HTML for Beginners | Lesson 01
What Is HTML? 💻 HTML for Beginners | Lesson 01
HTML Media Elements Explained – Images, Maps, Video & Audio in One Example
HTML Media Elements Explained – Images, Maps, Video & Audio in One Example

<li>This is a list item</li>

Using the `li` Tag in Practice

Let's explore how `li` is used in a practical context.

Consider the following example: ```html

HTML Full Notes for Beginners 💻
HTML Full Notes for Beginners 💻
What is HTML
What is HTML
🏷️ HTML Attributes Explained | The Secret Behind Powerful HTML Tags
🏷️ HTML Attributes Explained | The Secret Behind Powerful HTML Tags
887 reactions · 135 shares | HTML5 Tags information 2026. #coding #webdevelopment✨ #htmlcssjavascript #programming | Premi Coding | Facebook
887 reactions · 135 shares | HTML5 Tags information 2026. #coding #webdevelopment✨ #htmlcssjavascript #programming | Premi Coding | Facebook
a red and black text description for a web page with an arrow pointing to it
a red and black text description for a web page with an arrow pointing to it
🔗 HTML Links | Learn Hyperlinks in HTML (Lesson 5)
🔗 HTML Links | Learn Hyperlinks in HTML (Lesson 5)
  • Item 1
  • Item 2
  • Item 3
``` This code creates an unordered list, which by default is a bulleted list. The `li` tags in this case denote each item in the list. The result would look something like this: • Item 1 • Item 2 • Item 3

The `li` Tag with Ordered Lists

Just like the `ul` tag creates an unordered list, the `ol` tag creates an ordered list. The `li` tag functions similarly within these lists.

Here's an example: ```html

HTML Explained for Beginners | What Is HTML & How It Works (Simple Concept 2026)
HTML Explained for Beginners | What Is HTML & How It Works (Simple Concept 2026)
html
html
the ultimate guide to creating and formating tags
the ultimate guide to creating and formating tags
  1. First Step
  2. Second Step
  3. Third Step
``` This code would generate an ordered list (a numbered list) that looks like this: 1. First Step 2. Second Step 3. Third Step

Using `li` for Nested Lists

The `li` tag isn't limited to top-level lists. You can use it within other `li` tags to create nested lists, too.

For example: ```html

  • Top-level item 1
    • Sub-item 1
    • Sub-item 2
  • Top-level item 2
``` This code would render a list with sub-items:

  • Top-level item 1
    • Sub-item 1
    • Sub-item 2
  • Top-level item 2

Understanding and utilizing `li` tags properly is fundamental to creating accessible, visually pleasing, and easy-to-navigate web content.

So go forth, list lovers, and build your HTML webpage with confidence, knowing you're armed with a solid understanding of the `li` tag!

💬 Comments ↗ Share ★ Save
AD