▲Wirig Diagram Hot
▲ ▲ ▼

Unveiling UL & LI: Understanding HTML's Unordered Lists

By

Do you ever find yourself scrolling through a website, noticing the content listed in a neat, organized manner, and wonder how the creator achieved that? Today, we're delving into a commonly used HTML structure to help you understand just that: the trusty <ul> (unordered list) and <li> (list item) pair.

The <ul> and <li> tags are fundamental to HTML, enabling web developers to display content in a structured, easily comprehensible way. It's like giving shape to your ideas, converting a mere block of text into a well-defined outline. But first, let's understand what these tags do individually before exploring their symbiotic relationship.

The Unordered List <ul>

The <ul> tag is used to define an unordered list, i.e., a list where the order of items doesn't matter. This is represented by its default bullets.

HTML Lists: <ul> vs <ol> – When to Use Which? 📝
HTML Lists: <ul> vs <ol> – When to Use Which? 📝
a screenshot of a computer screen with some type of text in the bottom right corner
a screenshot of a computer screen with some type of text in the bottom right corner
Lesson 7: HTML Lists (Ordered & Unordered Lists) 📚
Lesson 7: HTML Lists (Ordered & Unordered Lists) 📚

By default, browsers display these lists with filled bullets. But these bullets are not just for aesthetics; they play a role in accessibility too. Screen readers identify these bullets as list items, making the content more navigable for visually impaired users.

Syntactical Use

Here's a simple example of how you use the <ul> tag. It'splacement is simple: enclose all your list items within its opening and closing tags.

Html inputs
Html inputs
Learn HTML UL TAg
Learn HTML UL TAg
HTML Full Notes for Beginners 💻
HTML Full Notes for Beginners 💻
```html
  • Item 1
  • Item 2
  • Item 3
```

Types of Lists

You can customize the bullet type with the <ul> type attribute. Common options aredisc, circle, and square, each producing a different style of bullet. For example:

```html
  • Disc style
```

The List Item <li>

The <li> tag is used to define a list item in an unordered or ordered list. It's the soul of any list; without it, your <ul> or <ol> (ordered list) would be just empty containers.

Each list item in a <ul> or <ol> is wrapped within a separate <li> tag, helping browsers identify each individual item. This improves the accessibility of your content, particularly for keyboard users who tab through the items.

🔗 HTML Links | Learn Hyperlinks in HTML (Lesson 5)
🔗 HTML Links | Learn Hyperlinks in HTML (Lesson 5)
different types of languages used in web development and application development, as well as programming
different types of languages used in web development and application development, as well as programming
html
html
URL Structure Explained 🌐 | Learn Parts of a Website Link Easily
URL Structure Explained 🌐 | Learn Parts of a Website Link Easily
10 Easy HTML Project Ideas for Beginners to Build Skills
10 Easy HTML Project Ideas for Beginners to Build Skills
What Is HTML? 💻 HTML for Beginners | Lesson 01
What Is HTML? 💻 HTML for Beginners | Lesson 01

Nesting <li> Tags

>Nesting <li> tags within <ul> or within other <li> tags (to create sub-lists) is a common practice. It's a great way to create clear, multi-level outlines. Here's an example:

```html
  • outer item 1
    • inner item 1
    • inner item 2
  • outer item 2
```

List Styling

CSS can be used to further customize your lists, allowing you to change bullet types, colors, font sizes, and more. For instance, to change all <li> styles:

```css li { color: blue; font-size: 16px; } ```

Understanding and mastering these tags is a great step in harnessing HTML's power to organize and present information effectively. Now that you've seen how <ul> and <li> work, it's time to put them into practice! So, what are you waiting for? Start creating beautiful, structured content today!

an image of a web page with the words in different languages
an image of a web page with the words in different languages
💬 Comments ↗ Share ★ Save
AD