Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App

HTML Lists

Last Updated : 15 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

An HTML List allows you to organize data on web pages into an ordered or unordered format to make the information easier to read and visually appealing. HTML Lists are very helpful for creating structured, accessible content in web development.

Types of HTML Lists

There are three main types of lists in HTML:

  1. Unordered Lists (<ul>): These lists are used for items that do not need to be in any specific order. The list items are typically marked with bullets.
  2. Ordered Lists (<ol>): These lists are used when the order of the items is important. Each item in an ordered list is typically marked with numbers or letters.
  3. Description Lists (<dl>): These lists are used to contain terms and their corresponding descriptions.

Basic Example of HTML Lists

HTML
<!DOCTYPE html> <html>    <body>     <h2>Welcome To GeeksforGeeks Learning</h2>     <h5>List of available courses</h5>     <ul>         <li>Data Structures & Algorithm</li>         <li>Web Technology</li>         <li>Aptitude & Logical Reasoning</li>         <li>Programming Languages</li>     </ul>        <h5>Data Structures topics</h5>     <ol>         <li>Array</li>         <li>Linked List</li>         <li>Stacks</li>         <li>Queues</li>         <li>Trees</li>         <li>Graphs</li>     </ol>    </body>  </html> 

Output:

html list example output
HTML List

HTML List Tags

TagDescription
<ul>Defines an unordered list.
<ol>Defines an ordered list.
<li>Defines a list item.
<dl>Defines a description list.
<dt>Defines a term in a description list.
<dd>Details the term in a description list.

Table of Content

  • 1. Using HTML Unordered List or Bulleted List
  • 2. Using HTML Ordered List
  • 3. Using HTML Description List

1. Using HTML Unordered List or Bulleted List

Unordered lists are ideal for scenarios where the sequence of the items is not important.

The unordered list items are marked with bullets, also known as bulleted lists. An unordered list starts with the <ul> tag, and each list item begins with the <li> tag.

Syntax:

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

Attribute: This tag contains two attributes which are listed below: 

  • compact: It will render the list smaller.
  • type: It specifies which kind of marker is used in the list.

Example:

This example describes the unordered list.

HTML
<!DOCTYPE html> <html>  <body>     <h2>Grocery list</h2>     <ul>         <li>Bread</li>         <li>Eggs</li>         <li>Milk</li>         <li>Coffee</li>     </ul> </body>  </html> 

2. Using HTML Ordered List

Ordered lists are used when the items need to follow a specific sequence.

In an ordered list, all list items are marked with numbers by default. An ordered list starts with the <ol> tag, and each list item begins with the <li> tag.

<ol>
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
</ol>

Attributes:

  • compact: It defines the list should be compacted (compact attribute is not supported in HTML5. Use CSS instead.).
  • reversed: It defines that the order will be descending.
  • start: It defines from which number or alphabet the order will start.
  • type: It defines which type(1, A, a, I, and i) of the order you want in your list of numeric, alphabetic, or roman numbers.

Example:

This example describes the ordered list with the use of reverse, type, and start attribute.

HTML
<!DOCTYPE html> <html>  <head>     <title>HTML ol tag</title> </head>  <body>     <h1 style="color: green">GeeksforGeeks</h1>     <h3>HTML ol tag</h3>      <p>reversed attribute</p>        <ol reversed>         <li>HTML</li>         <li>CSS</li>         <li>JS</li>     </ol>      <p>start attribute</p>       <ol start="5">         <li>HTML</li>         <li>CSS</li>         <li>JS</li>     </ol>      <p>type attribute</p>       <ol type="i">         <li>HTML</li>         <li>CSS</li>         <li>JS</li>     </ol> </body>  </html> 

Output:

html ordered list
Ordered List with different list style

3. Using HTML Description List

A description list is a list of terms, with a description of each term. Description lists are less common but very useful for definitions, glossaries, or any other key-value pairs of items.

The <dl> tag defines the description list, the <dt> tag defines the term name, and the <dd> tag describes each term.

Syntax: 

<dl>
<dt>Item 1</dt>
<dd>Description of Item 1 </dd>
<dt>Item 2</dt>
<dd>Description of Item 2</dd>
</dl>

Here, <dt> (description term) is used for the term being defined, and <dd> (description details) is used for the description.

Example:

This example describes the HTML Description List.

HTML
<!DOCTYPE html> <html>  <body>     <h2>A Description List</h2>     <dl>          <dt>Coffee</dt>         <dd>- 500 gms</dd>         <dt>Milk</dt>         <dd>- 1 ltr Tetra Pack</dd>     </dl> </body>  </html> 

Best Practices for Using HTML Lists

  • Semantic Correctness: Always use the appropriate type of list for your content to ensure semantic correctness and improve accessibility.
  • Nesting Lists: HTML lists can be nested inside one another. For example, you can place an unordered list inside an ordered list item to create a hierarchy.
  • Styling Lists: Use CSS to style lists to match the design of your website. You can change bullet styles in unordered lists, the numbering style in ordered lists, and more.
  • Accessibility: Make sure your lists are accessible. Properly structured lists help screen readers interpret the content accurately, enhancing the accessibility of your website.

Common Question About CSS List

  • How to implement various types of lists in HTML?
  • What is nesting of list & how to create the nested list in HTML?
  • How to set list in descending order in HTML5?
  • How to create a list with roman number indexing in HTML?
  • How to specify the kind of marker to be used in the list in HTML5?
  • What is the way to keep list of elements straight in HTML file?
  • How to create an unordered list with square bullets in HTML?
  • How to set the start value of an ordered list in HTML5?
  • What is Description List & what is the purpose of using it in HTML?
  • How to create an image bullets in HTML?
  • How to create space between list bullets and text in HTML?
  • Why do we need to declare the <ul> & <ol> tags in HTML?
  • How to Hide the Bullets on List for the Sidebar?
  • How to add description list of an element using HTML?
  • How to display a list in n columns format?
  • How to add a list elements within an unordered list element using jQuery?

S

Shubrodeep Banerjee
Improve
Article Tags :
  • Misc
  • Technical Scripter
  • Web Technologies
  • HTML
  • HTML-Basics
Practice Tags :
  • Misc

Similar Reads

    HTML Tutorial
    HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. It tells the web browser how to display text, links, images, and other forms of multimedia on a webpage. HTML sets up the basic structure of a website, and then CSS and JavaScript
    11 min read
    HTML Introduction
    HTML stands for Hyper Text Markup Language, which is the core language used to structure content on the web. It organizes text, images, links, and media using tags and elements that browsers can interpret. As of 2025, over 95% of websites rely on HTML alongside CSS and JavaScript, making it a fundam
    6 min read
    HTML Editors
    An HTML Editor is a software application designed to help users create and modify HTML code. It often includes features like syntax highlighting, tag completion, and error detection, which facilitate the coding process. There are two main types of HTML editors: Text-Based Editors - Allow direct codi
    5 min read
    HTML Basics
    HTML (HyperText Markup Language) is the standard markup language used to create and structure web pages. It defines the layout of a webpage using elements and tags, allowing for the display of text, images, links, and multimedia content. As the foundation of nearly all websites, HTML is used in over
    6 min read
    HTML Comments
    HTML comments are used to add notes or explanations in the HTML code that are not displayed by the browser.They are useful for documenting the code, making it easier to understand and maintain.To add a comment, use the syntax <!-- your comment here -->. HTML<!-- This is a comment and will n
    4 min read
    HTML Elements
    An HTML Element consists of a start tag, content, and an end tag, which together define the element's structure and functionality. Elements are the basic building blocks of a webpage and can represent different types of content, such as text, links, images, or headings.For example, the <p> ele
    5 min read
    HTML Attributes
    HTML Attributes are special words used within the opening tag of an HTML element. They provide additional information about HTML elements. HTML attributes are used to configure and adjust the element's behavior, appearance, or functionality in a variety of ways. Each attribute has a name and a value
    8 min read
    HTML Headings
    HTML headings are used to define the titles and subtitles of sections on a webpage. They help organize the content and create a structure that is easy to navigate.Proper use of headings enhances readability by organizing content into clear sections.Search engines utilize headings to understand page
    4 min read
    HTML Paragraphs
    A paragraph in HTML is simply a block of text enclosed within the <p> tag. The <p> tag helps divide content into manageable, readable sections. It’s the go-to element for wrapping text in a web page that is meant to be displayed as a distinct paragraph.Syntax:<p> Some Content...
    5 min read
    HTML Text Formatting
    HTML text formatting refers to the use of specific HTML tags to modify the appearance and structure of text on a webpage. It allows you to style text in different ways, such as making it bold, italic, underlined, highlighted, or struck-through. Table of ContentCategories of HTML Text FormattingLogic
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences