▲Wirig Diagram Hot
▲ ▲ ▼

What Are UL & LI Tags in HTML?

By

In the vast landscape of HyperText Markup Language (HTML), two common yet powerful tags you'll frequently encounter are the ul and li tags. These tags are instrumental in presenting information in a structured, organized manner on your web pages. Let's dive into the world of HTML to explore what these tags are and how they work together.

The ul tag stands for unordered list, and it's used to create a bulleted or unordered list of items. When used with the li tag (list item), it allows you to display a group of related items or points, helping to break down complex information into easily digestible chunks. Now, let's explore their usage in detail.

The Unordered List - ul

The ul tag is used to wrap around a group of list items, creating an unordered list. By default, HTML displays these items with hollow bullets, but this can be customized using CSS. Let's see how to create an unordered list.

HTML Lists: <ul> vs <ol> – When to Use Which? 📝
HTML Lists: <ul> vs <ol> – When to Use Which? 📝
a screenshot of a computer screen with some type of text in the bottom right corner
a screenshot of a computer screen with some type of text in the bottom right corner
Learn HTML UL TAg
Learn HTML UL TAg

Here's a basic example of how to use the ul and li tags:

  • Item 1
  • Item 2
  • Item 3

In this structure, the ul tag encloses the entire list, and each li tag within it represents an individual item in the list.

HTML Tag
HTML Tag
the ultimate guide to creating and formating tags
the ultimate guide to creating and formating tags
List of HTML Tags
List of HTML Tags

Nesting Unordered Lists

You can also nest unordered lists to create sublists or layers of information. This can be particularly useful for presenting hierarchical or complex data efficiently. Here's an example:

  • Fruits
    • Apples
    • Oranges
  • Vegetables

In this nested list, 'Fruits' is the parent list, and 'Apples' and 'Oranges' are its child lists.

Customizing Unordered Lists with CSS

While HTML provides the basic structure for unordered lists, CSS allows you to style them to fit your webpage's design. You can change the type of bullet points, the list's indentation, the color of the bullets, and more. Here's an example:

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
HTML Tags Cheat Sheet for Beginners | Learn HTML Fast | Web Development Basics
HTML Tags Cheat Sheet for Beginners | Learn HTML Fast | Web Development Basics
html
html
HTML TAG
HTML TAG
Quick HTML Tags Cheat Sheet
Quick HTML Tags Cheat Sheet
an image of what are attributes in html?
an image of what are attributes in html?
  • Custom bullet points
  • Indented list

In this example, the list uses hollow circles instead of the default filled bullets, and the list is indented for better readability.

The Ordered List - ol

Next to the unordered list, the ordered list is another fundamental list type in HTML. The ol tag (ordered list) is used to display a list of items in a specific order. By default, HTML numbers these items, but like unordered lists, these can be customized using CSS.

Here's how to create an ordered list:

an image of a web page with the words in different languages
an image of a web page with the words in different languages
Learn HTML Faster with This Cheat Sheet
Learn HTML Faster with This Cheat Sheet
  1. First item
  2. Second item
  3. Third item

In this structure, each li tag is an item in the ordered list, and they are numbered by default.

Nesting Ordered Lists

Just like unordered lists, ordered lists can be nested to create hierarchical structures of ordered items. Here's an example:

  1. Step 1
    1. Sub-step 1.1
    2. Sub-step 1.2
  2. Step 2

In this nested list, 'Step 1' is the parent list, and 'Sub-step 1.1' and 'Sub-step 1.2' are its child lists.

Customizing Ordered Lists with CSS

You can also use CSS to style ordered lists. You can change the numbering style, the list's indentation, and more. Here's an example:

  1. Custom numbering
  2. Indented list

In this example, the list uses lowercase alphabetic characters instead of the default numeric list, and the list is indented for better readability.

In conclusion, mastering the ul and li tags not only makes your HTML structured and well-organized but also improves the user experience by presenting information in a digestible and appealing manner. The ability to nest lists and customize them with CSS adds another layer of versatility to these simple yet powerful HTML tags. So, go ahead, experiment with these tags, and create engaging web pages!

💬 Comments ↗ Share ★ Save
AD