HTML Element: <ul>
[this page | pdf | back links]
The HTML <ul> element indicates an unordered
list. Inside the <ul>
element should be one or more <li> elements
identifying each entry in the unordered list.
The attributes
it can take are HTML
global attributes and HTML event attributes.
It used to support the compact and type attributes, but these are no longer supported by
HTML 5.
To create or access such
an element in JavaScript
see here. The
corresponding HTML DOM
object supports standard
DOM properties and methods. The default style applicable to this element is
shown here.
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
<br><br>Created using JavaScript:<br>
<span id="element"></span>
<script>
var y = document.getElementById("element")
var x = document.createElement("UL")
var x1 = document.createElement("LI");
var x2 = document.createElement("LI");
var txt1 = document.createTextNode("Apple");
var txt2 = document.createTextNode("Banana");
x1.appendChild(txt1);
x2.appendChild(txt2);
x.appendChild(x1);
x.appendChild(x2);
y.appendChild(x);
</script>
</body>
</html>
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Elements