HTML Lists – DEV Community
2 mins read

HTML Lists – DEV Community


HTML lists

An HTML List allows you to organize data on web pages into an ordered or unordered format to make the information easier to read and visually appealing. HTML Lists are very helpful for creating structured, accessible content in web development.Types of HTML Lists

There are three main types of lists in HTML:

1.Unordered Lists: These lists are used for items that do not need to be in any specific order. The list items are typically marked with bullets.
2.Ordered Lists: These lists are used when the order of the items is important. Each item in an ordered list is typically marked with numbers or letters.
3.Description Lists: These lists are used to contain terms and their corresponding descriptions.

HTML List Tags

Tag and its description
ul-Defines an unordered list.
ol-Defines an ordered list.
li-Defines a list item.
dl-Defines a description list.
dt-Defines a term in a description list.
dd-Details the term in a description list.

Table of Content

  1. Using HTML Unordered List or Bulleted List
  2. Using HTML Ordered List
  3. Using HTML Description List
  4. Using HTML Unordered List or Bulleted List

Unordered lists are ideal for scenarios where the sequence of the items is not important.
The unordered list items are marked with bullets, also known as bulleted lists. An unordered list starts with the ul tag, and each list item begins with the li tag.

Attribute: This tag contains two attributes which are listed below:
1.compact: It will render the list smaller.(TBD)
2.type: It specifies which kind of marker is used in the list.

2. Using HTML Ordered List

Ordered lists are used when the items need to follow a specific sequence.
In an ordered list, all list items are marked with numbers by default. An ordered list starts with the ol tag, and each list item begins with the li tag.

Attributes:
1.compact: It defines the list should be compacted (compact attribute is not supported in HTML5. Use CSS instead.).
2.reversed: It defines that the order will be descending.(TBD)
3.start: It defines from which number or alphabet the order will start.
4.type: It defines which type(1, A, a, I, and i) of the order you want in your list of numeric, alphabetic, or roman numbers.

3. Using HTML Description List

A description list is a list of terms, with a description of each term. Description lists are less common but very useful for definitions, glossaries, or any other key-value pairs of items.
The dl tag defines the description list, the dt tag defines the term name, and the dd tag describes each term.

Ref:https://www.geeksforgeeks.org/html/html-lists/



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *