Unordered HTML List

Unordered HTML 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 (small black circles) by default:

<ul>
  <li>Paul Tutorial</li>
  <li>HTML</li>
  <li>News Paul</li>
</ul>

Unordered HTML List - Choose List Item Marker

The CSS list-style-type property is used to define the style of the list item marker:

Value Description
disc Sets the list item marker to a bullet (default)
circle Sets the list item marker to a circle
square Sets the list item marker to a square
none The list items will not be marked

Example - Disc

<ul style="list-style-type:disc">
 <li>Paul Tutorial</li>  <li>HTML</li>
  <li>News Paul</li>
</ul>

Example - Circle

<ul style="list-style-type:circle">
  <li>Paul Tutorial</li>  <li>HTML</li>
  <li>News Paul</li>
</ul>

Example - Square

<ul style="list-style-type:square">
  <li>Paul Tutorial</li>  <li>HTML</li>
  <li>News Paul</li>
</ul>

Example - None

<ul style="list-style-type:none">
  <li>Paul Tutorial</li>  <li>HTML</li>
  <li>News Paul</li>
</ul>

Ordered HTML 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:

<ol>
  <li>Paul Tutorial</li>  <li>HTML</li>
  <li>News Paul</li>
</ol>

HTML Description Lists

HTML also supports description lists.
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), and the <dd> tag describes each term:
Example:

<dl>
  <dt>Paul Tutorial</dt>
  <dd>-HTML</dd>
  <dt>News Paul</dt>
  <dd>- digital world newspaper</dd>
</dl>

Summary

  • Use the HTML <ul> element to define an unordered list
  • Use the CSS list-style-type property to define the list item marker
  • Use the HTML <ol> element to define an ordered list
  • Use the HTML type attribute to define the numbering type
  • Use the HTML <li> element to define a list item
  • Use the HTML <dl> element to define a description list
  • Use the HTML <dt> element to define the description term
  • Use the HTML <dd> element to describe the term in a description list
  • Lists can be nested inside lists
  • List items can contain other HTML elements
  • Use the CSS property float:left or display:inline to display a list horizontally

No comments:

Post a Comment

How to Create Check and Uncheck - Radio Button ?

<script> var grd = function(){   $("input[type='radio']").click(function() {     var previousValue = $(this).attr(...

Popular Posts