Logo
Home / HTML
HTML Lists E-mail
Friday, 17 August 2007 / Kshitij Ahuja
Nobody likes to read long cluttered text in your web pages. In order to pass the message to the visitor quickly, your web page should have key points mentioned in the form of lists, to enable user go through them quickly and get your message. Remember, most of the users do not bother to read through the whole text of web page unless they are sure its what they are looking for. In other words, to catch their attention  and retain them to your page, lists are useful.

HTML supports several type of list elements that should be included within the body element of the document. These elements can be nested meaning they can be embedded one inside the another. ordered, unordered and definition lists.

Directory Lists
A directory list is used to present a list of items containing upto 20 characters each. Items in directory list may be arranged in columns, typically 24 characters wide.

A directory list starts with the <dir> tag. Each list item starts with the <li> tag.

<dir>
<li>1-20</li>
<li>21-40</li>
</dir>

Unordered Lists
An unordered list is a list of items which is separated by white space or is marked by bullets (typically small black circles).

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.

<ul>
<li>First List Item</li>
<li>Second List Item</li>
</ul>

The output in the browser looks like this :

• First List Item
• Second List Item

Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.

Ordered Lists
An ordered list is also a list of items, but this one is marked with numbers, in order of importance or the items are sorted by sequence.

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
<ol>
<li>First List Item</li>
<li>Second List Item</li>
</ol>

The output in the browser looks like this :

1. First List Item
2. Second List Item

Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.

Definition Lists
This list is used when a number of terms and definitions are to be included in the HTML document.

A definition list starts with the <dl> tag. Each definition-list term starts with the <dt> tag. Each definition-list definition starts with the <dd> tag.

<dl>
<dt>Term</dt><dd>Definition for first term</dd>
<dt>Term</dt><dd>Definition for second term</dd>
</dl>

The output in the browser looks like this :

Term
Definition for first term
Term
Definition for second term

List Tags
 
Tag Description
<ol>
<ul>
<li>
<dl>
<dt>
<dd>
<dir>
<menu>
 
Defines an ordered list
Defines an unordered list
Defines a list item
Defines a definition list
Defines a definition term
Defines a definition description
Deprecated. Use <ul> instead
Deprecated. Use <ul> instead
 
Home
Search Engine Optimization
HTML
Adobe Photoshop
PHP
Networking
Contact

Web Hosting by
WantToHost.com



Copyright © 2010 Tutorials Hub . All Rights Reserved.