HTML Academy · Lesson

Unordered Lists ul and li

Build bulleted lists with ul and li elements.

Lesson 1 of 413 steps

Unordered Lists ul and li is a free HTML Academy lesson on CoddyKit. This is lesson 1 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the HTML Academy learning path, and your progress syncs across the web and the CoddyKit app. The HTML Academy course includes 4 lessons in total.

What Is an Unordered List?

An unordered list displays items with bullet points — order does not matter:

<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

The ul Element

The <ul> (unordered list) element wraps the list. Only <li> elements should be direct children:

<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ul>
<!-- ul = unordered list (bullet points by default) -->
<!-- li = list item -->
<!-- Never put text directly inside ul without li -->

Styling Bullets with CSS

Control list markers with CSS:

ul {
  list-style-type: disc;       /* default: filled circle */
  /* circle, square, none */
}

/* Custom bullet with ::before */
ul li::before {
  content: '→ ';
  color: blue;
}

/* Remove all list styling: */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

Navigation as ul

Navigation menus are semantically a list of links:

<nav>
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/about">About</a></li>
    <li><a href="/blog">Blog</a></li>
    <li><a href="/contact">Contact</a></li>
  </ul>
</nav>

li Can Contain Any Content

List items can hold any flow content:

<ul>
  <li>
    <strong>HTML</strong>
    <p>The structure of the web.</p>
  </li>
  <li>
    <strong>CSS</strong>
    <p>The presentation layer.</p>
  </li>
</ul>

Inline Lists

Display list items horizontally with CSS:

<ul class="inline-list">
  <li>HTML</li>
  <li>CSS</li>
  <li>JS</li>
</ul>

<!-- CSS: -->
<!--
.inline-list {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1rem;
}
-->

Semantic Uses of ul

Common semantic uses for unordered lists:

  • Navigation menus
  • Feature lists
  • Tag clouds
  • Related links
  • Ingredient lists in recipes

ul vs p for Multiple Items

When you have multiple related items, a list is semantically better than separate paragraphs:

<!-- Bad: items that are actually a list -->
<p>- HTML</p>
<p>- CSS</p>
<p>- JavaScript</p>

<!-- Good: -->
<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

List Markers with list-style-image

Use a custom image as the list bullet:

ul {
  list-style-image: url('/icons/check.svg');
}

/* More reliable: use background-image on li::before */
ul li {
  list-style: none;
  padding-left: 1.5rem;
  background: url('/icons/check.svg') no-repeat left center;
  background-size: 1rem;
}

list-style Shorthand

The list-style shorthand sets type, position, and image:

ul {
  list-style: square inside;    /* type + position */
  list-style: none;             /* remove bullets */
}

/* list-style-position: inside vs outside */
ul {
  list-style-position: inside;  /* bullet inside padding box */
  /* outside = default, bullet outside text block */
}

Accessibility

Accessibility notes for lists:

  • Screen readers announce the list type and item count
  • Using list-style: none may cause some screen readers to not announce it as a list — add role="list" to preserve semantics
<ul style="list-style: none" role="list">
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

Quick Check

What is the only valid direct child element of ul?

Recap: Unordered Lists

Unordered list essentials:

  • <ul> wraps a list where order does not matter
  • <li> is the only valid direct child
  • Default bullet: disc; change with list-style-type
  • Navigation menus are semantically <ul> lists of links
  • Add role="list" if you remove bullets with CSS
Free to start

Learn HTML with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
40
Lessons
159

Frequently Asked Questions

Is the “Unordered Lists ul and li” lesson free?

Yes — any 3 lessons of the HTML Academy learning path, including “Unordered Lists ul and li”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The HTML Academy course includes 4 lessons in total.

What will I learn in “Unordered Lists ul and li”?

Build bulleted lists with ul and li elements. You practise HTML Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start HTML Academy?

No prior experience is required. HTML Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 1 of 4.

How long does the “Unordered Lists ul and li” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this HTML Academy lesson?

Yes. Every HTML Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Unordered Lists ul and li
  2. Ordered Lists ol start reversed type
  3. Description Lists dl dt dd
  4. Nested Lists and List Styling
← Back to HTML Academy