Lists in HTML

 Hello guys.. 

In this article we are discussed about List in HTML and their usages..

First of all what is a list?

List is a collection of  data which will used to give the order or combine the data of a particular topic 

For Example we are describing months. 

1. January

2. February

3. March

4. April

5. May

6. June

7. July

8. August

9. September

10. October

11. November

12. December

The months are always in a order so we are describing in a order But we are not describing like January, march, February like this because this is not a correct format. 

Here months are list.. And they are in an order.. And also we have names also but those are not ordered.. because we are not defining friends He/she is first and he/she is last.. 

1. Peter

2. Ajay

3. Bhaskar

4. Srikanth

These are also list only but order is not required here.. 


I hope you understand what I am trying to say? 


Here we have 2 types of lists available in HTML they are

1. Ordered List and 

2. Unordered List 


1. Ordered List:-  It is like months.. Means it is always having a particular order and also particular number of items in list. 

If we see the week. We have seven days in a week Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.. these are seven days in a week these all are in order only.. this is also an example of ordered list.. Mostly we are mentioning Numbers, alphabets, Roman Numbers for these lists. 


The basic syntax of ordered list 


<ol>

<li> item1</li>

<li> item2</li>

<li> item3</li>

.. 

</ol>


Here ol means ordered list. All these tags are container tags.. (Click here to know about tags) they are having both opening and closing tags. <ol> defines starting and ending of list. <li> defines the different items in the list. 

2. Unordered List:- It is like friends. Here order is not mandatory. If we are changing the order also not an issue.. So we don't have to use Numbering. Bullets like pointers etc., are used to define the list. 


In HTML we are using ul, ol for defining unordered and ordered lists. 

We are also use list items (li) for defining every item 



Syntax for Unordered List 


<ul> 

<li> item1</li> 

<li> item1</li> 

<li> item1</li> 

..

</ul>


Here ul means Unordered list. <li> tag is common for both ordered and unordered list. <ul> defines the starting and ending of unordered list. There is only one change is <ul> / <ol>. Both syntaxes are same. 

The final output of the both ordered and unordered lists are in the below


Here bullet points and numbering are default parameters we can also change the values 


If you like our content Please follow our blog and comment your opinion on the article.. 

4 Comments

Post a Comment

Previous Post Next Post