MyInternships.in

HTML Basics

HTML Lists

Lists group related items so they are easy to scan. HTML offers three types: unordered (bullets), ordered (numbers), and description lists for term-and-definition pairs.


What is an HTML List?

A list groups a set of related items. Unordered lists (<ul>) show a bullet before each item and are for items where order does not matter. Ordered lists (<ol>) number the items, which is ideal for steps or rankings.

In both cases each item is wrapped in an <li> tag. A third type, the description list (<dl>), pairs terms with their descriptions — useful for glossaries and metadata.

Basic Usage

Unordered and ordered lists
Example
<ul>
  <li>Bulleted item</li>
  <li>Another item</li>
</ul>

<ol>
  <li>First step</li>
  <li>Second step</li>
</ol>

Example: The Three List Types

See each list render
Example
<!DOCTYPE html>
<html>
<body>
  <h3>Skills (unordered)</h3>
  <ul>
    <li>HTML</li>
    <li>CSS</li>
    <li>JavaScript</li>
  </ul>

  <h3>Steps (ordered)</h3>
  <ol>
    <li>Write the code</li>
    <li>Save the file</li>
    <li>Open in a browser</li>
  </ol>

  <h3>Glossary (description)</h3>
  <dl>
    <dt>HTML</dt>
    <dd>The structure of a page.</dd>
    <dt>CSS</dt>
    <dd>The style of a page.</dd>
  </dl>
</body>
</html>

More Examples

Nested lists for sub-items
Example
<ul>
  <li>Front-end
    <ul>
      <li>HTML</li>
      <li>CSS</li>
    </ul>
  </li>
  <li>Back-end
    <ul>
      <li>Node.js</li>
      <li>Databases</li>
    </ul>
  </li>
</ul>
Changing bullet and number styles
Example
<ul style="list-style-type:square;">
  <li>Square bullet</li>
  <li>Square bullet</li>
</ul>

<ol type="A">
  <li>Item A</li>
  <li>Item B</li>
</ol>

List Tags Reference

TagPurpose
<ul>Unordered (bulleted) list.
<ol>Ordered (numbered) list.
<li>A single list item.
<dl>Description list container.
<dt>A term in a description list.
<dd>The description of that term.
💡

Use an ordered list only when sequence actually matters, like steps in a recipe. If items are just a group, use an unordered list.

ℹ️

Website navigation menus are usually built as an unordered list of links styled with CSS — semantically it is a list of destinations.

Key Takeaways

  • Use <ul> for bullets, <ol> for numbered steps.
  • Every list item goes in an <li> tag.
  • Use <dl>, <dt>, and <dd> for term-and-definition pairs.
  • Lists can be nested to show sub-items.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships