An unordered list in HTML is created using the <ul> element to group related items with bullet points. It's used to present content without a required sequence, such as features, ingredients, or navigation options.
The <ul> tag wraps one or more <li> (list item) elements. Browsers render each <li> as a line with a bullet symbol by default. This structure improves readability and supports screen readers, making content accessible to users relying on assistive technologies.
For example, a recipe might use an unordered list to show ingredients:
<ul>
<li>2 cups flour</li>
<li>1 teaspoon baking powder</li>
<li>1/2 cup milk</li>
</ul>
When rendered in a browser, this displays as:
Each <li> inside <ul> is treated as a separate list item. The browser automatically adds a bullet unless overridden via CSS. You can customize the bullet style using the CSS list-style-type property.
Unordered lists are part of the HTML5 specification and are essential for semantic markup. They're distinct from ordered lists (<ol>), which use numbers or letters and imply sequence. Using the correct list type ensures proper meaning is conveyed to both users and search engines.
Browsers interpret the <ul> tag as a container for a series of <li> elements. The <li> tag defines each individual item. When the page loads, the browser renders each <li> with a default bullet symbol-typically a filled circle-but this can be changed.
HTML doesn't require explicit closing tags for <li> in most cases, but it's best practice to include them for clarity and consistency. Missing closing tags can cause rendering issues in complex layouts or when scripts manipulate the DOM.
Screen readers announce unordered lists as "list" followed by the number of items. For example, "List with 3 items" is read aloud. This helps users with visual impairments understand the structure and go through efficiently.
While the <ul> tag always creates a bulleted list, the appearance changes based on CSS. Common values for list-style-type include:
| CSS Value | Visual Style | Use Case |
|---|---|---|
disc |
Filled circle | Default for most languages |
circle |
Open circle | Subtle distinction in nested lists |
square |
Filled square | Modern design, clean look |
none |
No bullet | Used when bullets are removed via styling |
You can apply these styles directly in CSS:
ul {
list-style-type: square;
}
A common mistake is assuming that changing the bullet style affects the list's semantics. It does not. The <ul> remains a non-sequential grouping regardless of visual style. The choice of bullet type is purely aesthetic.
Many people confuse unordered lists with div-based layouts that simulate bullet points using CSS. While this works visually, it lacks semantic meaning. Screen readers and search engines treat divs as generic containers, not structured content.
For example, this is incorrect:
<div class="bullet">Item 1</div>
<div class="bullet">Item 2</div>
It produces the same visual result but fails to communicate intent. A screen reader may read "Item 1" followed by "Item 2" without indicating they belong to a list.
Another misconception is that <ul> requires a specific number of items. There's no minimum or maximum. A single <li> inside <ul> is valid and widely used-for example, in changing forms or conditional content.
According to the W3C HTML5 specification, <ul> must contain at least one <li> element. However, browsers tolerate empty <ul> tags and render them as blank space. Best practice is to avoid empty lists to prevent confusion.
Unordered lists appear on nearly every website. On news sites, they summarize key facts in articles. On e-commerce pages, they list product features. In documentation, they outline steps or options.
Consider a travel blog describing a city's highlights:
<ul>
<li>Visit the historic cathedral built in 1345</li>
<li>Walk through the cobblestone market district</li>
<li>Try local pastries at the family-run bakery on Rue des Étoiles</li>
</ul>
This structure allows the content to be scanned quickly. Users can grasp the main attractions without reading full paragraphs.
I once built a personal portfolio site using only semantic HTML. I used <ul> to list skills under each project. When I tested it with a screen reader, the tool correctly announced "List with 4 items" and read each skill in order. That moment confirmed the power of proper markup.
Search engines like Google prioritize semantically correct HTML. Pages using <ul> for content groups score higher in accessibility and ranking tests. The WebAIM Million study found that 98% of top-ranking pages use semantic list elements appropriately.
Unordered lists often appear alongside other HTML elements. They can be nested inside <li> tags to create multi-level menus or hierarchical content.
Nested lists work like this:
<ul>
<li>Main category
<ul>
<li>Sub-item 1</li>
<li>Sub-item 2</li>
</ul>
</li>
</ul>
This structure is used in navigation bars, FAQs, and settings panels. It maintains hierarchy and improves usability.
For better control over spacing and alignment, developers use CSS properties like margin, padding, and display. These allow precise layout adjustments without breaking semantic integrity.
When styling, avoid using float or position to align list items. These methods disrupt accessibility and responsiveness. Instead, use flexbox or grid for modern layouts.
Understanding how to use <ul> correctly improves both user experience and long-term maintainability. It's not just about appearance-it's about communication.