DEV Community

jolamemushaj
jolamemushaj

Posted on

Html lists

HTML lists are used to group together related pieces of information. All lists may contain one or more list elements. There are three different types of HTML lists:

  1. - Unordered List - bulleted List <ul>
  2. - Ordered List - numbered List <ol>
  3. - Description List - definition List <dl>

HTML Unordered Lists - An unordered list is a collection of related items that have no special order. The Unordered list starts with <ul> tag and list items start with the<li> tag. Each item in the list is marked with a bullet.

<ul>  
 <li>Michael</li>  
 <li>Pamela</li>  
 <li>Dwight</li>  
</ul>
Enter fullscreen mode Exit fullscreen mode

HTML Ordered Lists - In the ordered HTML lists, all the list items are marked with numbers by default. It is known as numbered list also. The ordered list starts with <ol> tag. The numbering starts at one and is incremented by one for each list element tagged with <li>.

<ol>  
 <li>Angela</li>  
 <li>Oscar</li>  
 <li>Kevin</li>  
</ol>
Enter fullscreen mode Exit fullscreen mode

The type attribute for <ol> tag is used to specify the type of numbering you want to use:

<ol type = "1"> - Default-Case Numerals.
<ol type = "I"> - Upper-Case Numerals.
<ol type = "i"> - Lower-Case Numerals.
<ol type = "A"> - Upper-Case Letters.
<ol type = "a"> - Lower-Case Letters.

HTML Description Lists - A description list is a list of terms, with a description of each term.

<dl> - defines a description list
<dt> - defines a term in a description list
<dd> - describes the term in a description list

Example:

<dl>
  <dt>Michael</dt>
  <dd>- world's best boss</dd>
  <dt>Pam</dt>
  <dd>- the office receptionist</dd>
</dl>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)