HTML Lists

HTML Lists are used to specify lists of information. All lists may contain one or more list elements.

There are three different types of HTML lists as below:

  1. Ordered List or Numbered List (ol)
  2. Unordered List or Bulleted List (ul)
  3. Description List or Definition List (dl)

 

HTML Ordered List or Numbered List

We can group a set of related items in lists using Ordered List as below.

Syntax for Ordered List or Numbered List (ol) :

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

The ordered list starts with <ol> tag and the list items start with <li> tag.

HTML Unordered List or Bulleted List

We can group a set of related items in lists using Unordered List as below.

Syntax for Unordered List or Bulleted List (ul) :

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

The Unordered list starts with <ul> tag and the list items start with <li> tag.

HTML Description List or Definition List

We can group a set of related items in lists using Description List as below.

Syntax for Description List or Definition List(dl) :

<dl>
  <dt>Item 1</dt>
  <dd>- Item 1 description</dd>
  <dt>Item 2</dt>
  <dd>- Item 2 description</dd>
</dl>

The HTML definition list contains below three tags 

<dl> tag defines the start of the list.
<dt> tag defines a term.
<dd> tag defines the term definition (description).

Let's see below example to understand HTML Lists in details.

Example :

<!DOCTYPE html>
<html>
<head>
<title>Learn HTML Lists by aryatechno</title>
</head>
<body>

<p><h3>Ordered HTML List for online tutorials</h3></p>
<p>
<ol>
<li>PHP</li>
<li>HTML</li>
<li>MYSQL</li>
<li>CSS</li>
</ol>
</p>


<p><h3>Unordered HTML List for online tutorials</h3></p>
<p>
<ul>
<li>PHP</li>
<li>HTML</li>
<li>MYSQL</li>
<li>CSS</li>
</ul>
</p>

<p><h3>HTML Description List for online tutorials</h3></p>
<p>
<dl>
<dt>PHP </dt>
<dd>- PHP stands for Hypertext Preprocessor. PHP is a server scripting language to create dynamic web pages.</dd>
<dt>HTML</dt>
<dd>- It is HyperText Markup Language for Web pages.</dd>
<dt>CSS</dt>
<dd>- CSS is Cascading Style Sheets to style an HTML document.</dd>
</dl>
</p>

</body>
</html>

Output :

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

55465