Lists
Lists are the next element in an XHTML document. A great way of laying out information on the web is through lists. Lists are simple to read and easy to comprehend. They make a web page attractive. The user can retain more data if it is presented to him in a list.
Lists in XHTML are quite similar to the lists in HTML. The only difference is that some attributes of lists used in HTML are not supported by XHTML.
Before going into lists in detail it is imperative to understand the concept of the list index tag.
List Index Tag
The list index tag is written as <li>. It defines the start of a list item. The <li> tag is used in both unordered and ordered lists.
| The example of list index tag is shown with the example of unordered and ordered lists later. |
Unordered List
An unordered list is defined by the tag <ul>. It contains a list of items in which the items are preceded by bullets or markers.
| |
| Example |
<ul> |
<li>Classic jokes </li> |
<li>Math jokes </li> |
<li>Food jokes</li> |
</ul> |
|
| Output |
|
|
The "compact" and "type" attributes of the <ul> tag of HTML are not supported in XHTML.
The following example illustrates the use of lists in a web page:
| Example |
<html> |
|
<head> |
<title> My list of jokes </title> |
</head> |
|
<body> |
|
<h1>This is my list of jokes </h1> |
|
<ul> |
<li>Classic jokes </li> |
<li>Math jokes </li> |
<li>Food jokes</li> |
</ul> |
|
<hr/> |
|
<ol> |
<li>Crazy jokes</li> |
<li>Ethnic jokes</li> |
<li>Golf jokes</li> |
</ol> |
|
</body> |
</html> |
|
| |
This is how the web page looks:
|