🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

<ul>

AI & DATA SCIENCE // ul-tag

The <ul> element represents an unordered list — a group of items with no inherent sequence, rendered as bullet points by default.

Syntax

<ul>
  <li>First item</li>
  <li>Second item</li>
</ul>

Deep Dive Course

**`<ul>`** groups a set of `<li>` (list item) children where order doesn't matter semantically — ingredients, feature lists, navigation links. Browsers render each `<li>` with a bullet marker by default, which CSS's `list-style-type` can change or remove entirely. If the sequence of items genuinely matters (steps in a recipe, ranked results), use `<ol>` instead, since that carries the correct 'this order matters' meaning.

1Understanding <ul>

`<ul>` groups a set of <li> (list item) children where order doesn't matter semantically — ingredients, feature lists, navigation links. Browsers render each <li> with a bullet marker by default, which CSS's list-style-type can change or remove entirely. If the sequence of items genuinely matters (steps in a recipe, ranked results), use <ol> instead, since that carries the correct 'this order matters' meaning.

💡

Removing bullets with CSS (list-style: none) is common for nav menus built from <ul>/<li>, but the semantic meaning — 'this is a list of items' — is still valuable for screen readers even without visible bullets.

editor.html
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>
localhost:3000

2Practical Example

Here is a real-world application of <ul> showing how it is used in production HTML.

editor.html
<!-- Common pattern: nav menu built from an unordered list -->
<nav>
  <ul style="list-style: none; display: flex; gap: 1rem;">
    <li><a href="/">Home</a></li>
    <li><a href="/about">About</a></li>
  </ul>
</nav>
localhost:3000

3Best Practices

Follow these guidelines when working with <ul>:

1. Use <ul> when item order has no meaning

2. Use <ol> instead when sequence/ranking matters

3. Style bullets via CSS list-style-type rather than manually typing bullet characters

⚠️

Tip: Removing bullets with CSS (list-style: none) is common for nav menus built from <ul>/<li>, but the semantic meaning — 'this is a list of items' — is still valuable for screen readers even without visible bullets.

editor.html
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>
localhost:3000

Examples

Example 01Basic Usage
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>
Example 02Advanced Example
<!-- Common pattern: nav menu built from an unordered list -->
<nav>
  <ul style="list-style: none; display: flex; gap: 1rem;">
    <li><a href="/">Home</a></li>
    <li><a href="/about">About</a></li>
  </ul>
</nav>

Best Practices

  • Use
      when item order has no meaning
    • Use
        instead when sequence/ranking matters
      1. Style bullets via CSS list-style-type rather than manually typing bullet characters

Interview Question

Why do many navigation menus use <ul>/<li> even when they're styled with no visible bullets?

Hint: Think about what a screen reader announces about a list, regardless of its visual bullet styling.

Screen readers announce list structure independently of visual styling — e.g. 'list, 4 items' — which helps users understand there are exactly 4 navigation options and navigate between them, even when list-style: none removes the visible bullets. Using generic <div>s instead for the same visual layout would lose that structural announcement entirely, making the navigation harder to use with assistive technology.

Exercises

EasyPractice using <ul> in a real scenario.
View Solution
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

Frequently Asked Questions

Why do many navigation menus use <ul>/<li> even when they're styled with no visible bullets?

Screen readers announce list structure independently of visual styling — e.g. 'list, 4 items' — which helps users understand there are exactly 4 navigation options and navigate between them, even when list-style: none removes the visible bullets. Using generic

s instead for the same visual layout would lose that structural announcement entirely, making the navigation harder to use with assistive technology.

Related Functions

ol-tagli-tag