There are several types of list, an un-ordered list can be created by the following markup:
Displayed by browser
HTML markup required
Item one of list
Item two of list
<ul>
<li>Item one of list </li>
<li>Item two of list </li>
</ul>
Nested lists can be done as follows. Note that mark nested lists up correctly
you need to understand that any nested list is actually a child of a list item.
Displayed by browser
HTML markup required
Item one of list
Item two of list
Subitem one of item two
Subitem two of item two
Item three of list
<ul>
<li>Item one of list </li>
<li>Item two of list
<!-- Closing </li> tag not placed here! -->
<ul>
<li>Subitem one of item two </li>
<li>Subitem two of item two </li>
</ul>
</li> <!-- Closing </li> for item two here -->
<li>Item three of list </li>
</ul>
It is also possible to specify the appearance of unordered lists:
Displayed by browser
HTML markup required
Item one of list
Item two of list
<ul>
<li>Item one of list </li>
<li>Item two of list </li>
</ul>
Item one of list
Item two of list
ul {
list-style-type: circle;
}
<ul>
<li>Item one of list </li>
<li>Item two of list </li>
</ul>
Item one of list
Item two of list
ul {
list-style-type: square;
}
<ul>
<li>Item one of list </li>
<li>Item two of list </li>
</ul>
<ul>
<li class="a">Item one of list </li>
<li class="b">Item two of list </li>
<li class="c">Item three </li>
<li class="d">Item four </li>
</ul>
Ordered Lists
An ordered list is similar to an un-ordered list, except that each entry is consecutively numbered.
Displayed by browser
HTML markup required
Item one of list
Item two of list
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
</ol>
Nested lists can be done as follows:
Displayed by browser
HTML markup required
Item one of list
Item two of list
Subitem one of item two
Subitem two of item two
Item three of list
<ol>
<li>Item one of list </li>
<li>Item two of list
<ol>
<li>Subitem one of item two </li>
<li>Subitem two of item two </li>
</ol>
</li>
<li>Item three of list </li>
</ol>
It is also possible to specify the appearance of unordered lists:
Displayed by browser
HTML markup required
Item one of list
Item two of list
Item three of list
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
<li>Item three of list </li>
</ol>
Item one of list
Item two of list
Item three of list
ol {
list-style-type: upper-alpha;
}
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
<li>Item three of list </li>
</ol>
Item one of list
Item two of list
Item three of list
ol {
list-style-type: lower-alpha;
}
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
<li>Item three of list </li>
</ol>
Item one of list
Item two of list
Item three of list
ol {
list-style-type: upper-roman;
}
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
<li>Item three of list </li>
</ol>
Item one of list
Item two of list
Item three of list
ol {
list-style-type: lower-roman;
}
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
<li>Item three of list </li>
</ol>
It is possible to give a start value to the ordered list or to reset the counter:
Displayed by browser
HTML markup required
Item one of list
Item two of list
Item three of list
Item four of list
<ol start="3">
<li>Item one of list </li>
<li>Item two of list </li>
<li>Item three of list </li>
<li>Item four of list </li>
</ol>
Item one of list
Item two of list
Item three of list
Item four of list
<ol>
<li>Item one of list </li>
<li>Item two of list </li>
<li value="1">Item three of list </li>
<li>Item four of list </li>
</ol>
Note:start and value attributes were deprecated in HTML 4.01, but now SUPPORTED in HTML5.
It is possible to reverse an ordered list and display it in descending order:
Displayed by browser
HTML markup required
Item four of list
Item three of list
Item two of list
Item one of list
<ol reversed>
<li>Item four of list </li>
<li>Item three of list </li>
<li>Item two of list </li>
<li>Item one of list </li>
</ol>
Lists for navigation
The <ul> or <ol> can now be enclosed within <nav> elements for better semantic structure when used as navigational menus. For example:
Displayed by browser
HTML markup required
<style>
.nav-bar {
list-style-type: none; /* Removes bullet points */
margin: 0; /* No extra space around the navbar */
padding: 0; /* No extra space around the navbar */
background-color: #333; /* navbar background colour */
}
/* Style each list item */
.nav-bar li {
display: inline-block; /* Align items horizontally */
margin: 0;
}
/* Style the links */
.nav-bar li a { /* <a> tag looks like button */
display: block; /* Make the clickable area a block */
color: white; /* Link text color */
text-decoration: none; /* Remove underline */
padding: 14px 20px; /* Padding around the link */
background-color: #333; /* Match navbar background */
text-align: center;
}
/* Add hover effects */
.nav-bar li a:hover {
background-color: #575757; /* Hover bg color */
color: #fff; /* Text color on hover */
}
/* Optional: Make the navigation bar full-width */
.nav-bar {
justify-content: space-around; /* Evenly space items */
}
</style>
A description list is used to display name/value pairs such as terms and their definitions.
Displayed by browser
HTML markup required
Definition tag.
Text of the definition list. Which may
stretch over several lines.
Another definition tag.
Text of the definition list.
<dl>
<dt>Definition tag.</dt>
<dd>Text of the definition list. Which may
stretch over several lines.</dd>
<dt>Another definition tag.</dt>
<dd>Text of the definition list.</dd>
</dl>
HTML5 allows for greater flexibility and semantic use of description lists. You can wrap groups of <dt> and <dd> elements within a <div> or <section> for better grouping.
Lists with image bullets
It is possible to use your own graphics as bullets in an unordered list:
Images will be discussed in more details in Lecture 3.
ARIA for HTML5 Lists
Accessible Rich Internet Applications (ARIA) roles and properties are used to enhance accessibility for screen readers and assistive technologies. When working with lists in HTML5, ARIA attributes can be applied to improve semantic meaning and ensure accessibility for users with disabilities.
Here is a breakdown of how ARIA can be used with HTML5 lists:
Native HTML lists (<ul>, <ol>, <dl>) already provide semantic structure and accessibility, thus do not need to add ARIA roles. However, ARIA roles may be needed when creating custom or dynamic lists using non-native HTML elements (e.g., <div> or <span>) for complete control over the styling from the ground up. For example if you need to develop dynamic components (e.g., dropdown menus, accordions, or drag-and-drop lists) you may find <div> or <span> easier to work with programmatically due to their general-purpose nature. It is advised to let native semantics do the heavy lifting wherever possible.
ARIA helps convey additional information such as relationships, states, and roles for complex or custom components.
The table below provides some examples for creating lists using <div> or <span> integrating ARIA for accessibility.
Test your understanding of Janet Compliance Regulations and Policies by answering the following questions:
What is the primary purpose of the Janet network, and why is compliance with its regulations important for educational institutions?
What are the key legal frameworks that influence Janet compliance, and how do they impact network users? (e.g., GDPR, Computer Misuse Act 1990, NIS Regulations 2018)
Describe three security best practices that institutions and individuals should follow to comply with Janetâs security policies.
How does accessibility relate to Janet compliance, and what legal requirements must institutions meet to ensure digital accessibility?
What are the potential consequences of violating Janetâs Acceptable Use Policy (AUP), and how can institutions prevent compliance breaches?