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>

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