ul tag (XHTML 1.0)

unordered list

Topics

The ul tag is used for creating an Unordered List, which is a list with bulletpoints instead of e.g. numbers or letters indicating an order. You can create a simple unordered list like this:

<ul>
<li>John Doe</li>
<li>Jane Doe</li>
<li>...and all the others</li>
</ul>

The result will look something like this:

As you can see, we use the <li> tag. It simply tells the browser that the containing text is a list item. Everything within a set of <ul> tags should be list items.

The type attribute

The most interesting attribute of the ul tag, is the type attribute. It allows you to define how the bullet points will look like. Click the type link, for a list of possible values. Here's an example where we use square bulletpoints instead of the default round ones:

<ul type="square">
<li>John Doe</li>
<li>Jane Doe</li>
<li>...and all the others</li>
</ul>

The result looks like this:

Unfortunately, the type attribute has been deprecated. If you wish to create pages which validates, you should use the CSS alternative list-style-type instead:

<ul style="list-style-type: square;">
<li>John Doe</li>
<li>Jane Doe</li>
<li>...and all the others</li>
</ul>

In general, CSS offers you a lot of options for styling you list. You can play around with the following CSS properties:

Attributes

Attribute Deprecated Required Description
class  space-separated list of classes 
compactX reduced interitem spacing 
dir  direction for weak/neutral text 
id  document-wide unique id 
lang  language code 
style  associated style info 
title  advisory title 
typeX bullet style 

Events

Event Description
onclicka pointer button was clicked 
ondblclicka pointer button was double clicked 
onkeydowna key was pressed down 
onkeypressa key was pressed and released 
onkeyupa key was released 
onmousedowna pointer button was pressed down 
onmousemovea pointer was moved within 
onmouseouta pointer was moved away 
onmouseovera pointer was moved onto 
onmouseupa pointer button was released 



© htmlpedia.net 2008 - 2012