Bulleted Lists
<ul type="bullet type">
<li> List Item
<li> List Item
<li> List Item
</ul>ul element. The ul element employs a <ul> start tag and and </ul> end tag and must contain at least one or more list items which are placed in between. Each list item is preceded by a <li> start tag of which the </li> end tag is optional.This example will illustrate:
Example 1 - SOURCE CODE
The following is a bulleted or 'unordered' list of the kinds of lists you can create using HTML:
<ul>
<li> Unordered lists (bulleted)
<li> Ordered lists (numbered or alphabetized)
<li> Definition lists (term/definition format)
</ul>Example 1 - RESULT
The following is a bulleted or 'unordered' list of the kinds of lists you can create using HTML:
- Unordered lists (bulleted)
- Ordered lists (numbered or alphabetized)
- Definition lists (term/definition format)
Using the
type attribute, you can specify what kind of "bullet type" to display in your list. The values you can use are disc, circle or square. Here's an example displaying three lists containing one list item each and using different values for the type attribute: Example 2 - SOURCE CODE
<ul type="disc">
<li> Disc
</ul>
<ul type="circle">
<li> Circle
</ul>
<ul type="square">
<li> Square
</ul>Example 2 - RESULT
- Disc
- Circle
- Square
The
ul element is a block element and initially behaves like a paragraph by separating itself from other lists (and block elements) with a line of blank space. The li element is also a block element and hence may contain other block elements. Thus, if you really wanted to get adventurous, you could 'nest' one list inside the other, or in other words, have list items contain other lists.Example 3 illustrates nesting lists within lists within lists. The source code is specially color-coded and indented to help you tell what's what (note that the indenting in the source code is not related to the indenting in the final result):
Example 3 - SOURCE CODE
<font size="4">HTML LISTS AND STYLE TYPES</font>
<ul>
<li> <b>Unordered Lists</b>
<ul>
<li> Disc bullet
<li> Circle bullet
<li> Square bullet
</ul>
<li> <b>Ordered Lists</b>
<ul>
<li> Numbered
<ul>
<li> Decimal
<li> Lowercase Roman numeral
<li> Uppercase Roman numeral
</ul>
<li> Alphabetized
<ul>
<li> Lowercase
<li> Uppercase
</ul>
</ul>
<li> <b>Definition Lists</b>
<ul>
<li> Term/Definition style
</ul>
</ul>In the above example:
-
Maroon Boldindicates a list at the top level (disc). -
Greenindicates a second-level list (circle). -
Redindicates a third-level list (square). -
Blueindicates other HTML text formats.
HTML LISTS AND STYLE TYPES
- Unordered Lists
- Disc bullet
- Circle bullet
- Square bullet
- Ordered Lists
- Numbered
- Decimal
- Lowercase Roman numeral
- Uppercase Roman numeral
- Alphabetized
- Lowercase
- Uppercase
- Numbered
- Definition Lists
- Term/Definition style
Note how since no
type attributes were specified in any of the lists in Example 3 then the main list and its subsequent nested lists display default bullet types which change according to how deep the respective list is nested. Hence, the main or 'top level' list defaults to disc, the second level to circle and the third level to square.
As you can see by the above, other list styles include numbered and alphabetized lists which together are categorized in HTML as ordered lists. These will be covered next...
| INTRO | TOP | NEXT ~> |
