HTML5 Reference

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>

Attributes

The following attributes can be used with the <ul> tag.


<ul> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <ul> tag.
<ul> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<ul class="name">Unordered list</ul>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<ul id="name">Unordered list</ul>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<ul style="color:red;">Unordered list</ul>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<ul title="Content info">Unordered list</ul>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<ul accesskey="a">Unordered list</ul>
tabindexSpecifies a tab order for the element.

<ul tabindex="1">Unordered list</ul>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<ul dir="ltr">Unordered list</ul>
<!-- The text will flow from right to left -->
<ul dir="rtl">Unordered list</ul>
langSpecifies a language code for the content of the element.

<ul lang="en">Unordered list</ul>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited/browser specific. -->
<ul spellcheck="true">Unordered list</ul> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<ul translate="no">Unordered list</ul> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<ul contenteditable="true">Unordered list</ul> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<ul draggable="true">Unordered list</ul>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<ul hidden>Unordered list</ul> 
<ul hidden="hidden">Unordered list</ul> 
<ul> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<ul oncopy="go()">Unordered list</ul> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<ul oncut="go()">Unordered list</ul>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<ul onpaste="go()">Unordered list</ul>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<ul ondrag="go()">Unordered list</ul>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<ul ondragend="go()">Unordered list</ul>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<ul ondragenter="go()">Unordered list</ul>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<ul ondragleave="go()">Unordered list</ul>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<ul ondragover="go()">Unordered list</ul>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<ul ondragstart="go()">Unordered list</ul>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<ul ondrop="go()">Unordered list</ul>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<ul onblur="go()">Unordered list</ul>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<ul onchange="go()">Unordered list</ul>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<ul oncontextmenu="go()">Unordered list</ul>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<ul onfocus="go()">Unordered list</ul>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<ul oninput="go()">Unordered list</ul>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<ul oninvalid="go()">Unordered list</ul>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<ul onreset="go()">Unordered list</ul>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<ul onselect="go()">Unordered list</ul>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<ul onsubmit="go()">Unordered list</ul>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<ul onkeydown="go()">Unordered list</ul>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<ul onkeypress="go()">Unordered list</ul>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<ul onkeyup="go()">Unordered list</ul>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<ul onabort="go()">Unordered list</ul>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<ul oncanplay="go()">Unordered list</ul>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<ul oncanplaythrough="go()">Unordered list</ul>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<ul oncuechange="go()">Unordered list</ul>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<ul ondurationchange="go()">Unordered list</ul>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<ul onemptied="go()">Unordered list</ul>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<ul onended="go()">Unordered list</ul>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<ul onloadeddata="go()">Unordered list</ul>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<ul onloadedmetadata="go()">Unordered list</ul>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<ul onloadstart="go()">Unordered list</ul>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<ul onpause="go()">Unordered list</ul>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<ul onplay="go()">Unordered list</ul>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<ul onplaying="go()">Unordered list</ul>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<ul onprogress="go()">Unordered list</ul>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<ul onratechange="go()">Unordered list</ul>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<ul onseeked="go()">Unordered list</ul>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<ul onseeking="go()">Unordered list</ul>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<ul onstalled="go()">Unordered list</ul>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<ul onsuspend="go()">Unordered list</ul>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<ul ontimeupdate="go()">Unordered list</ul>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<ul onvolumechange="go()">Unordered list</ul>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<ul onwaiting="go()">Unordered list</ul>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<ul onclick="go()">Unordered list</ul>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<ul ondblclick="go()">Unordered list</ul>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<ul onmousedown="go()">Unordered list</ul>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<ul onmousemove="go()">Unordered list</ul>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<ul onmouseout="go()">Unordered list</ul>>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<ul onmouseover="go()">Unordered list</ul>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<ul onmouseup="go()">Unordered list</ul>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<ul onwheel="go()">Unordered list</ul>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<ul onscroll="go()">Unordered list</ul> 
Window - NONE

Relevant HTML Tutorials

HTML Lessons - Lists