HTML Lists

HTML provides three types of lists: unordered, ordered, and definition lists. HTML Lists are essential for structuring content on web pages.

Unordered Lists

Use <ul> for unordered lists. Each list item is wrapped in <li>.


  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>

Ordered Lists

For ordered lists, employ <ol>. Similarly, wrap each item in <li>.


  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>

Nested Lists

You can nest lists inside other lists to create a hierarchy.


  <li>Main item 1</li>
  <li>Main item 2
      <li>Subitem 1</li>
      <li>Subitem 2</li>
  <li>Main item 3</li>

Definition Lists

Definition lists are created using <dl>, <dt>, and <dd>.


  <dt>Term 1</dt>
  <dd>Definition 1</dd>
  <dt>Term 2</dt>
  <dd>Definition 2</dd>

Adding Attributes

Lists can have attributes for customization.

Example with a class:

<ul class="custom-list">
  <li>Item 1</li>
  <li>Item 2</li>

Styling Lists with CSS

Enhance the visual appeal of your lists using CSS for styling.


.custom-list {
  color: #3498db;
  font-size: 16px;


  • Item 1
  • Item 2

Accessibility Considerations

Ensure your lists are accessible by using semantic HTML and providing appropriate ARIA attributes.

Remember, practice is key to mastering HTML lists. Experiment with different types and styles to enhance your web design skills.