Tuesday, 20 October 2015

HTML Lists

HTML List

Example of an unordered list and an ordered list in
 HTML:

Unordered List:

  • Item
  • Item
  • Item
  • Item

Ordered List:

  1. First item
  2. Second item
  3. Third item
  4. Fourth item


Unordered HTML Lists

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):

Example

<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>


Unordered HTML Lists - The Style Attribute

style attribute can be added to an unordered list, to define the style of the marker:
StyleDescription
list-style-type:discThe list items will be marked with bullets (default)
list-style-type:circleThe list items will be marked with circles
list-style-type:squareThe list items will be marked with squares
list-style-type:noneThe list items will not be marked

Disc:

<ul style="list-style-type:disc">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

Circle:

<ul style="list-style-type:circle">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

Square:

<ul style="list-style-type:square">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>

No comments:

Post a Comment