An unordered or unnumbered list tag, better known in shorthand as the UL tag, provides a way for web page designers to display and group text on web pages as indented and bulleted lists. UL tags are used in hypertext markup languages (HTML) pages and as a style element defined in a cascading style sheet (CSS). While UL tags did not become standardized until HTML 2.0, it had been defined in the first published descriptions of HTML by Tim Berners-Lee in 1992. This element is supported by all major web browsers.
UL tags may be used in the BODY, DIV, CENTER, BLOCKQUOTE, FORM, TH, TD, DD, or LI tags. The UL tag in HTML is denoted by an opening <UL> and closing </UL> tag, which also inserts an empty space in the line before and after the tag. CSS UL tags, which provide additional formatting flexibility beyond the HTML UL tag, are defined within the ul {list-style-type:
<UL>
<LI>Apples
<LI>Bananas
<LI>Oranges
<LI>Pineapples
</UL>
Unordered lists do require the use of attributes, although there are a core set of attributes – class, id, style and title – as well as a number of standard, or optional, attributes that may be useful to modify the look of an unordered list. Except for the compact and type attributes, which were standardized in version 2.0, optional attributes were not formally standardized until version 4.0.
The compact attribute squeezes both the bulleted text and definition onto one line. Type defines the bullet style, which automatically defaults to disc if no type is specified. Other pre-defined bullet types used in UL HTML tags include the square and circle. User-defined images may be used in place of pre-defined bullet types by specifying the location of the stored images using the src attribute, as in <UL src=”URL">. The uniform resource locator, or URL, indicates the location of the image. Starting with version 4.0.1, the compact and type attributes for the UL tag have been deprecated, meaning it may not be supported in future HTML versions.
Other attributes used to define the UL tag style include:
- DIR: this attribute contains information regarding the direction of the text.
- ID: defines the specific ID on the CSS property to tag.
- LANG: encodes the language.
- STYLE: defines the CSS inline style.
JavaScript event handlers, which define what happens, for example, if a mouse hovers over a HTML UL tag or when the user clicks on a list item, may also be used to refine an unordered list. Event handlers supported by UL tags include onClick, onDbClick, onMouseDown, onMouseUp, OnMouseOver, onMouseMOve, onMouseOut, onKeyPress, onKeyDown, and onKeyUp.