Lists

HTML Lists

Structuring structured items using ordered, unordered, and description list tags.

HTML provides three main structures for listing information: unordered bulleted lists, ordered numbered lists, and description lookup lists.

List Formats

  • <ul>: Unordered (bulleted) list.
  • <ol>: Ordered (numbered) list.
  • <li>: List item (children of <ul> or <ol>).
  • <dl>: Description List.
  • <dt>: Description Term.
  • <dd>: Description details (explains the term).

Example

html
<ul>

<li>HTML</li>

<li>CSS</li>

</ul>

Interview questions

Sign in to save

Can elements other than <li> be direct children of <ul> or <ol>?

No. According to HTML specs, the only allowed direct children of `<ul>` and `<ol>` tags are `<li>` elements, plus `<script>` or `<template>` elements. Placing other tags (like `<div>` or `<a>`) directly under `<ul>` is invalid HTML.

Practice

Write a description list outlining HTML and CSS definitions.

Hint: Use <dl> as the root container, with <dt>HTML</dt> followed by <dd>Hypertext Markup Language</dd>.