The <ul> HTML tag is used to specify an unordered list. It works in the same way as the <ol> tag but by default shows each list item with a bullet point instead of a number. This can be styled with CSS. The <ul> tag is used to indicate the whole list. Within this tag each list item is listed using the <li> HTML tag. This can also be used in conjuction with the <a> HTML tag and is the accepted way to define navigation links over table based HTML layout options. It works equally as well in table based layouts as well as CSS based ones. When text is put between the opening and closing <ul> tag it is displayed as a table caption text.
<ul>Some unordered list text in here</ul>
Any text between the opening and closing tag will be displayed as unordered list text.
It is possible to style and add functionality to the <ul> tag, this is done by adding an attribute to after the ul in the opening <ul> tag
Attributes allowed for the <ul>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<ul id=”header”>Some unordered list text</ul>
With all attributes there is a space after the initial ul then the attribute name, then an equal’s sign and the identifier of the attribute in double quotes.
Both id and class attributes refer to CSS styling of the element and is either stored in the <head> of the webpage on in an external file.
With id this usually refers to a single instance on a page where as class usually refers to a repeating element on a page, it is for this reason for the <ul> tag may use either the id or class as an atribute.
The attribute style allows you to include css style information for a single <ul> tag.
The dir attribute allows for left reading and right reading text, lang allows you to specify a language for the tag and title allows you to include extra information for a tag.
<ul>Some unordered list text</ul> – basic usage example.
<ul id=”header>Some unordered list text</ul> – unordered list text which is styled by the id header.
<ul class=”headerclass”> Some unordered list text </ul> – unordered list text which is styled by the class headerclass.
<ul id =”header” class=”headerclass”> Some unordered list text </ul> – unordered list text which is styled by the class headerclass and the id header.
<ul style="color:#F00">Some unordered list text</ul> – unordered list text which has a custom colour of red.
<ul dir="rtl">Some unordered list text</ul> – unordered list text where the text reads from right to left.
<ul lang="uk">Some unordered list text</ul> – unordered list text where the language has been tagged as UK.
<ul title="ptitle">Some unordered list text</ul> – unordered list text where the tag has been titled ptitle.
Touching on just the surface of the <ul> HTML tag it is easy to see how versatile it is. To take full advantage of it an understanding of CSS is an advantage.