![]() |
Lists are used to store data or information in web pages in ordered or unordered form. HTML supports several types of list elements that can be included in the <BODY>tag of the document. These elements may also be nested, i.e., the onset of elements can be embedded within another. There are three types of list available in HTML:
Now before moving to the list first of all we understand what is a list item tag. List Item tagList item tag is used to define each item of a list. Once we define list items with the <li> tag, the list appears in Web browsers in the bulleted form (by default). It is used inside both ordered and unordered lists. Syntax:
Attribute of item tag: value: The value attribute of the<li> tag is used to specify the value of the first item. The value must be a number and this can be used in the case of an ordered list only. The subsequent list items will increment the value from the number. Syntax: <li value = number> Example 1: HTML
Output: Example 2: >HTML
Output: Now we will discuss all the lists provided by the HTML one by one in detail: Ordered listAn ordered list defines a list of items in which the order of the items are matters. An ordered list is also called a number list. The ordering is given by a numbering scheme, using Arabic numbers, letters, Roman numerals. Or in other words, ordered list tag is used to create an ordered list. Different ways to number the ordered lists using the type attribute:
Syntax:
Attributes of an ordered list: 1. reversed: This attribute is used to specify that the order of the list should be reversed. Syntax:
2. start: This attribute is used to specify the start value of the list. Syntax:
3. type: This attribute is used to specify the type of list item maker. The value of this attribute is decimal(Default)/lower-roman/upper roman/lower-alpha/upper alpha Syntax:
Example 1: HTML
Output: Example 2: HTML
Output: Unordered listAn unordered list defines a list of items in which the order of the items does not. Or in other words, an unordered list tag is used to create an unordered list. It is also known as bulleted list. In an unordered list each element in the list is defined using <li> tag. There are 4 types of style in unordered lists: ● type=”disc”- sets the list item marker to a bullet (default) ○ type=”circle”- sets the list item marker to a circle ■ type=”square”- sets the list item marker to a square type=”none”- the lists items will not be marked Syntax:
Attributes of an unordered list: List-style-type: This attribute is used to specify the bullet style that will be used as the list item marker. The value of this attribute is None/disc(default)/circle/square. Syntax:
Example 1: HTML
Output: Example 2: HTML
Output: Description listDescription list is a list in which each term contains its description. This tag contains <dt> and <dd> tag.
Syntax:
Example: HTML
Output: |
Reffered: https://www.geeksforgeeks.org
Class 7 |
Related |
---|
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |