Skip to main content

HTML - Lists

HTML offers web authors three ways for specifying lists of information. All lists must contain one or more list elements. Lists may contain −
  • <ul> − An unordered list. This will list items using plain bullets.
  • <ol> − An ordered list. This will use different schemes of numbers to list your items.
  • <dl> − A definition list. This arranges your items in the same way as they are arranged in a dictionary.

HTML Unordered Lists

An unordered list is a collection of related items that have no special order or sequence. This list is created by using HTML <ul> tag. Each item in the list is marked with a bullet.

Example

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Unordered List</title>
   </head>
 
   <body>
      <ul>
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ul>
   </body>
   
</html>
This will produce the following result −

The type Attribute

You can use type attribute for <ul> tag to specify the type of bullet you like. By default, it is a disc. Following are the possible options −
<ul type = "square">
<ul type = "disc">
<ul type = "circle">

Example

Following is an example where we used <ul type = "square">
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Unordered List</title>
   </head>

   <body>
      <ul type = "square">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ul>
   </body>

</html>
This will produce the following result −

Example

Following is an example where we used <ul type = "disc"> −
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Unordered List</title>
   </head>
 
   <body>
      <ul type = "disc">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ul>
   </body>

</html>
This will produce the following result −

Example

Following is an example where we used <ul type = "circle"> −
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Unordered List</title>
   </head>

   <body>
      <ul type = "circle">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ul>
   </body>
 
</html>
This will produce the following result −

HTML Ordered Lists

If you are required to put your items in a numbered list instead of bulleted, then HTML ordered list will be used. This list is created by using <ol> tag. The numbering starts at one and is incremented by one for each successive ordered list element tagged with <li>.

Example

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Ordered List</title>
   </head>

   <body>
      <ol>
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>

</html>
This will produce the following result −

The type Attribute

You can use type attribute for <ol> tag to specify the type of numbering you like. By default, it is a number. Following are the possible options −
<ol type = "1"> - Default-Case Numerals.
<ol type = "I"> - Upper-Case Numerals.
<ol type = "i"> - Lower-Case Numerals.
<ol type = "A"> - Upper-Case Letters.
<ol type = "a"> - Lower-Case Letters.

Example

Following is an example where we used <ol type = "1">
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Ordered List</title>
   </head>

   <body>
      <ol type = "1">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>

</html>
This will produce the following result −

Example

Following is an example where we used <ol type = "I">
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Ordered List</title>
   </head>
 
   <body>
      <ol type = "I">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>
 
</html>
This will produce the following result −

Example

Following is an example where we used <ol type = "i">
<!DOCTYPE html>
<html>
   
   <head>
      <title>HTML Ordered List</title>
   </head>
 
   <body>
      <ol type = "i">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>
 
</html>
This will produce the following result −

Example

Following is an example where we used <ol type = "A" >
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Ordered List</title>
   </head>
 
   <body>
      <ol type = "A">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>
 
</html>
This will produce the following result −

Example

Following is an example where we used <ol type = "a">
<!DOCTYPE html>
<html>
   
   <head>
      <title>HTML Ordered List</title>
   </head>
 
   <body>
      <ol type = "a">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>
 
</html>
This will produce the following result −

The start Attribute

You can use start attribute for <ol> tag to specify the starting point of numbering you need. Following are the possible options −
<ol type = "1" start = "4">    - Numerals starts with 4.
<ol type = "I" start = "4">    - Numerals starts with IV.
<ol type = "i" start = "4">    - Numerals starts with iv.
<ol type = "a" start = "4">    - Letters starts with d.
<ol type = "A" start = "4">    - Letters starts with D.

Example

Following is an example where we used <ol type = "i" start = "4" >
<!DOCTYPE html>
<html>

   <head>
      <title>HTML Ordered List</title>
   </head>
 
   <body>
      <ol type = "i" start = "4">
         <li>Beetroot</li>
         <li>Ginger</li>
         <li>Potato</li>
         <li>Radish</li>
      </ol>
   </body>
 
</html>
This will produce the following result −

HTML Definition Lists

HTML and XHTML supports a list style which is called definition lists where entries are listed like in a dictionary or encyclopedia. The definition list is the ideal way to present a glossary, list of terms, or other name/value list.
Definition List makes use of following three tags.
  • <dl> − Defines the start of the list
  • <dt> − A term
  • <dd> − Term definition
  • </dl> − Defines the end of the list

Example

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Definition List</title>
   </head>
 
   <body>
      <dl>
         <dt><b>HTML</b></dt>
         <dd>This stands for Hyper Text Markup Language</dd>
         <dt><b>HTTP</b></dt>
         <dd>This stands for Hyper Text Transfer Protocol</dd>
      </dl>
   </body>
 
</html>
This will produce the following result −

Comments

Popular posts from this blog

The new TAG Heuer Carrera Calibre Tourbillon Nanograph is a lot of buzzwords in a beautiful package

Almost every word in the name of TAG Heuer’s new watch – the Carrera  Calibre Heuer 02T Tourbillon Nanograph – is important. Carrera connects it to TAG’s long history of chronographs while Calibre suggests a handmade watch made with some technical prowess. Tourbillon means you can expect this thing to cost more than a car (about $25,000 when it goes on sale) and Nanograph suggests that this thing is doing something quite unique. And it is. TAG Heuer loves experimenting with new materials and the Nanograph features a new hairspring design that is unique to TAG. The hairspring, which is made of carbon-composite, is lightweight and unaffected by gravity or shock. It also offers “perfect concentric oscillations” and is completely antimagnetic. Couple that with the rotating tourbillon and the suggestion is that this watch will remain accurate under all sorts of pressure. Further, rest of the movement includes carbon fiber and aluminum which reduces the effects of temperat...

Realme U1 Review: Perfect Package With Required Features

Hello friends, the Realme U1 smartphone has MediaTek Helio P70 processor. You will see what features & drawbacks there are in it. You also know whether this Realme smartphone is worth buying or not. Just a 6-month-old smartphone company, Realme, has made great recognition in a short span of time. The company has so far launched 5 of its total smartphones and they all come in less than Rs 20,000. The aim of the company is to draw the youth of the country on their side so that real-time smartphones can be seen in more hands. Realme U 1 has a starting price of Rs 11,999 and with this price, the Chinese company wants to give tough competition to the companies like xiaomi, Huawei & Honor in the budget category. Realme U1 is the world's first handset with the MediaTek Helio P70 processor. The most important feature of the phone is the 25 megapixel front camera and 3500mAh strong battery. Design of Realme U1 At first glance, Realme looks like the previous company o...

Asus ROG Phone goes up for pre-order in the UK with £100 discount

After  yesterday's launch in the UK , the Asus ROG Phone is finally set to hit the shelves in the country. However, you still need to wait until December 14 when the actual shipments start but if you hurry up and pre-order you can get the phone for £100 off. Otherwise, the actual price of the phone is £799 and can be found on Asus' official website. Unfortunately, though, there's still no word on the accessories and how much will they cost. We guess we will have to wait some more to find out.