Tuesday, May 3, 2011

HTML: List


Index Based List


Generally the index based list is two types –


1.      Numbered or Ordered

2.      Bulleted or Unordered


The following tags are used to those two types –


1.      <ol>

<ol> is the ordered list. This tag is used to keep any document like 1, 2, 3 format.


2.      <ul>

<ul> is unordered list. This tag is used to keep any document in bullets format.


3.      <li>

<li> is the list tag. This tag is used within the <ol> and <ul> tag.




Use of OL Tag


We can use <ol> tag to keep any document like 1, 2, 3 or A, B, C or i, ii, iii format. To do this we need to declare the type attribute within the <ol> tag.


Program


<html>

<head>

            <title>Planet List</title>

</head>



<body>

            <ol type="1">

            <li>Earth</li>

            <li>Saturn</li>

            <li>Pluto</li>

            </ol>

</body>

</html>



Result



















You can use A or roman i with the type attribute. If you want to create a list which starting value is 15, just write 15 with the attribute type and it will begin from 15.


Use of UL Tag


<ul> tag is used to create unordered list. The program writing procedure is same as <ol> tag. Here the bullete is used like as number. See the program –



Program


<html>

<head>

            <title>Planet List</title>

</head>



<body>

            <ul type=square>

            <li>Earth</li>

            <li>Saturn</li>

            <li>Pluto</li>

            </ul>

</body>

</html>



Result




















You can use the attribute value as square, circle, disk etc.


DD Tag


The meaning of <dd> tag is Identifies Definition. This tag create a space before first line of a paragraph. As a ending tag </dd> is not essential but if you want you can use it. See the program –


Program


<html>

<head>

            <title>List</title>

</head>



<body>

<dd>The web page is the document that is created by a Markup Language called HTML.

The web browser is used to read the HTML document and display them as a web page.

</body>

</html>




Result

No comments:

Post a Comment