"I am Saqib Jahangir. A passionate vlogger, software engineer, and avid traveler with a deep love for exploring the hidden gems of our beautiful planet. With a strong foundation in Application Development, Application Architecture & Database Design and Product Management, I bring over a decade of hands-on experience building secure, scalable, and resilient web applications for a diverse range of industries."

Lists

Lists help organize information clearly on a webpage. There are two main types of lists in HTML:

1. Unordered List (<ul>)

  • Displays items with bullets (dots).
  • Use it when the order of items doesn't matter.

Example:

<ul>

  <li>HTML</li>

  <li>CSS</li>

  <li>JavaScript</li>

</ul>

How it looks:

  • HTML
  • CSS
  • JavaScript

2. Ordered List (<ol>)

  • Displays items with numbers or letters.
  • Use it when the order or sequence matters.

Example:

<ol>

  <li>Open your text editor</li>

  <li>Write HTML code</li>

  <li>Save the file</li>

  <li>View it in the browser</li>

</ol>

How it looks:

  1. Open your text editor
  2. Write HTML code
  3. Save the file
  4. View it in the browser

3. List Item (<li>)

  • Represents each item in both ordered and unordered lists.
  • Must be placed inside <ul> or <ol> tags.

Example Page to Try (with XAMPP/WAMP)

Create a file named lists.html and paste:

<!DOCTYPE html>

<html>

<head>

  <title>HTML Lists Example</title>

</head>

<body>

 

  <h2>Unordered List Example</h2>

  <ul>

    <li>Apple</li>

    <li>Banana</li>

    <li>Cherry</li>

  </ul>

 

  <h2>Ordered List Example</h2>

  <ol>

    <li>Wake up</li>

    <li>Brush Teeth</li>

    <li>Have Breakfast</li>

  </ol>

 

</body>

</html>

Open it via your local server (http://localhost/lists.html) and see the difference between unordered and ordered lists.

 


Popular Posts

Setting Up Your First Project Folder and Installing XAMPP or WAMP

Frontend vs Backend vs Full Stack