HTML <ul> tagS2C Home   « HTML <ul> tag

Definition

The <ul> tag defines an unordered list.

Example


<ul>
  <li>Tin of Tomatoes</li>
  <li>Bacon</li>
  <li>Loaf of Bread</li>
  <li>Mushrooms</li>
</ul>

Required Attributes

NONE

Optional Attributes

compact - this attribute is deprecated, use CSS instead.

type - this attribute is deprecated, use CSS instead.

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<ul class="classname"></ul>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<ul id="idname"></ul>

style - specifies an inline style for the element allowing you to apply the style to the content.


<ul style="color:red;text-align:left"></ul>

title - specifies extra information about the content.


<ul title="information about the content"></ul>

Language Attributes

dir - specifies the directional flow of the content.


<ul dir="ltr"></ul>   <!-- The text will flow from left to right -->

<ul dir="rtl"></ul>   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.


<ul lang="en"></ul>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<ul xml:lang="fr"></ul>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<ul onkeydown="go()"></ul>   <!-- Executes the go() function -->

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<ul onkeypress="go()"></ul>   <!-- Executes the go() function -->

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<ul onkeyup="go()"></ul>   <!-- Executes the go() function -->

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<ul onclick="go()"></ul>   <!-- Executes the go() function --> 

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<ul ondblclick="go()"></ul>   <!-- Executes the go() function -->

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<ul onmousedown="go()"></ul>   <!-- Executes the go() function -->

onmousemove - The JavaScript code to be run when the mouse button is moved.


<ul onmousemove="go()"></ul>   <!-- Executes the go() function -->

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<ul onmouseout="go()"></ul>   <!-- Executes the go() function -->

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<ul onmouseover="go()"></ul>   <!-- Executes the go() function -->

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<ul onmouseup="go()"></ul>   <!-- Executes the go() function -->

go to home page Homepage go to top of page Top