0% completed
In this lesson, you'll learn how to create unordered (bulleted) lists in HTML using the <ul>
tag. Unordered lists are ideal for displaying items that don't require a specific order, such as features, ingredients, or any collection of related items.
An HTML unordered list is a list of items where the sequence doesn't matter. Each item in the list is typically marked with a bullet point. The <ul>
tag is used to create unordered lists, and each list item is wrapped in an <li>
(list item) tag. Unordered lists help organize content in a clear and readable manner, enhancing the structure of your web pages.
The basic syntax for creating an unordered list is as follows:
<ul> <li>First item</li> <li>Second item</li> <li>Third item</li> </ul>
<ul>
: The opening tag for the unordered list.<li>
: The list item tag used to define each item within the list.</ul>
: The closing tag for the unordered list.Let's explore two practical examples of using the <ul>
tag to create unordered lists.
This example demonstrates a simple unordered list without any additional attributes. The list items are marked with default bullet points.
Explanation:
<ul>
tag creates an unordered list of features offered by TechGrind.io.<li>
tag represents a specific feature.The type
attribute allows you to change the style of the bullet points in an unordered list. While the type
attribute is deprecated in HTML5, it's still supported by many browsers for backward compatibility. Alternatively, CSS is recommended for styling lists in modern web development.
Explanation:
<ul>
tag has a type="circle"
attribute that changes the default bullet points from filled circles to hollow circles.<li>
tag represents an item with the customized bullet style.Note: For more advanced and flexible styling of list bullets, it's recommended to use CSS. Here's how you can achieve similar results with CSS:
Explanation:
<style>
section defines a CSS class called .square-bullets
that changes the bullet points of the list to hollow circles using list-style-type: circle;
.<ul>
tag has the class square-bullets
, which applies the custom bullet style to all its <li>
items.<li>
tag represents an individual item in the unordered list, now displayed with hollow circle bullets instead of the default filled discs.Understanding how to effectively use unordered lists enhances the structure and presentation of your web content, making it more user-friendly and visually appealing. In the next lesson, we'll explore HTML Nested Lists, where you'll learn how to create more complex list structures by embedding lists within lists.
.....
.....
.....