HTML

Last Updated: 9/18/2022

Lists

Lists allows to group a set of related items.

Unordered List

  • An unordered list starts with the <ul> tag.
  • Each list item starts with the <li> tag.
  • The list items will be marked with bullets
  • Lists can be nested
  • List items can contain other HTML elements
<ul>
	<li>Item 1</li>
	<li>Item 2</li>
	<li>Item 3</li>
</ul>

Ordered List

  • An ordered list starts with the <ol> tag.
  • Each list item starts with the <li> tag.
  • The list items will be marked with numbers by default
  • The type attribute of the <ol> tag, defines the type of the list item marker
  • The type values are
    • 1 - numbers,
    • A - uppercase letters,
    • a - lowercase letters,
    • I - uppercase roman,
    • i - lowercase roman
  • Lists can be nested
  • List items can contain other HTML elements
  • By default, an ordered list will start counting from 1. You can use the start attribute to start counting from a specified number
<ol type="1">
	<li>Item 1</li>
	<li>Item 2</li>
	<li>Item 3</li>
</ol>

Description List

  • A description list is a list of terms, with a description of each term.
  • The <dl> tag defines the description list,
  • The <dt> tag defines the term (name),
  • The <dd> tag details of each term
  • Used for glossaries and metadata
<dl>
	<dt>Term 1</dt>
	<dd>Description of term 1</dt>
	
	<dt>Term 2</dt>
	<dd>Description of term 2/dt>
</dl>