▲Wirig Diagram Hot
▲ ▲ ▼

HTML UL Tag: Create Ordered & Unordered Lists -- Examples & Best Practices

By

The

    tag in HTML is an essential element for creating unordered lists. It's a container for items that are not in any specific order, and it's often used for lists of options, like navigation menus or general bullet-pointed lists. This tag is a useful tool for making your content more readable and engaging. Let's dive into some practical examples to understand its usage better.

    Before we delve into the examples, it's crucial to understand that the

      tag works in tandem with the
    • tag, which is used to define the list items. The
    • tag can contain text or other HTML elements, creating flexible and dynamic lists.

      Basic unordered list example

      Here's a basic example of an unordered list using the

        and
      • tags:

        • Apples
        • Bananas
        • Cherries

        As you can see, each list item is enclosed within an

      • tag, and the entire list is contained within a
          tag. By default, unordered lists render as bullet points, which helps to differentiate them from ordered lists.

          Embedding elements within list items

          The

        • tag can contain more than just text. It can also encapsulate other HTML elements, creating rich and varied lists. Let's explore this with an example:

          In this list, list items include bold text, a link, and a heading, demonstrating the flexibility of the

            and
          • tags.

            Creating nested unordered lists

            You can also create nested unordered lists by placing a

              tag inside another list item. This can be useful for creating lists with sub-lists, like a hierarchical menu:

              • Fruits
                • Apples
                • Bananas
              • Vegetables
                • Lettuce
                • Tomatoes

              The resulting list will show 'Fruits' and 'Vegetables' as main list items, with their respective sub-items indented beneath them.

              Customizing list styling

              Now that we understand how to create unordered lists, let's explore how to customize their styling. By default, unordered lists have filled bullet points, but you can replace these with custom list markers by using CSS.

              Using list-style-type property

              CSS provides the list-style-type property for customizing list markers. Here's an example:

              • Circles
              • Squares
              • Triangles

              In this example, the list-style-type property is set to 'circle', changing the list markers to hollow circles.

              Using CSS classes

              For more complex styling, you can use CSS classes. Here's an example:

              • Trees
              • Forests
              • Mountains

              In this example, a CSS class named 'custom-list' is defined to remove the default list markers, add padding, and use a custom icon (a tree emoji) for each list item.

              Understanding and mastering the use of the

                and
              • tags can greatly improve your HTML skills and help you create more engaging and readable content. Practice with different list types, styles, and nesting levels to gain a deeper understanding of these versatile tools.

Learn HTML UL TAg
Learn HTML UL TAg
Un-ordered list style styles
Un-ordered list style styles
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
Quick HTML Tags Cheat Sheet
Quick HTML Tags Cheat Sheet
HTML Lists: <ul> vs <ol> – When to Use Which? 📝
HTML Lists: <ul> vs <ol> – When to Use Which? 📝
🏷️ HTML Tags Cheat Sheet | Essential Tags Every Beginner Should Know
🏷️ HTML Tags Cheat Sheet | Essential Tags Every Beginner Should Know
List of HTML Tags
List of HTML Tags
the ultimate guide to creating and formating tags
the ultimate guide to creating and formating tags
HTML All Tags Cheat Sheet | Complete HTML5 Reference for Beginners & Developers
HTML All Tags Cheat Sheet | Complete HTML5 Reference for Beginners & Developers
HTML Document Structure & Text Tags Explained | Coding Cheat Sheet
HTML Document Structure & Text Tags Explained | Coding Cheat Sheet
Complete HTML Tags Reference: Your Essential Web Dev Cheat Sheet 📝
Complete HTML Tags Reference: Your Essential Web Dev Cheat Sheet 📝
HTML Tags Every Beginner Must Know
HTML Tags Every Beginner Must Know
HTML Meta Tags
HTML Meta Tags
an open notebook with sticky notes on it
an open notebook with sticky notes on it
Commonly Used HTML Tags with Examples - DataFlair
Commonly Used HTML Tags with Examples - DataFlair
💬 Comments ↗ Share ★ Save
AD