
Html ordered and unordered lists are a great way to present a list of items in a clear and organized manner. They're commonly used on websites and in web applications to display information in a structured format.
Ordered lists, also known as numbered lists, are used to display a list of items in a specific order. This is achieved using the tag. For example, in the article section "Creating an Ordered List", we saw how to create a numbered list of items using the tag inside the tag.
Unordered lists, on the other hand, are used to display a list of items without a specific order. This is achieved using the tag. As we saw in the article section "Creating an Unordered List", we can create a bulleted list of items using the tag inside the tag.
In both cases, the tag is used to define each list item.
Discover more: Types of Iphones in Order
Creating Ordered Lists
An ordered list defines a list of items where the order matters, and it's also known as a number list. The ordering is given by a numbering scheme, using Arabic numbers, letters, or Roman numerals.
There are different ways to number ordered lists using the type attribute. You can choose from decimal, lowercase letters, uppercase letters, lowercase Roman numbers, or uppercase Roman numbers.
To specify the start value of the list, you can use the start attribute. For example, you can start the list with the number 30 instead of 1. You can also use the reversed attribute to specify that the order of the list should be reversed.
Curious to learn more? Check out: Start in Html
Using the Start Attribute
You can start an ordered list from a specific number using the start attribute. This attribute is available for the element.
To specify a value for the start attribute, you can use a number, like 30, to start the list from that number instead of 1. For example, if you want to start the list with the number 30, you can specify the number 30 as the value of the start attribute.
Consider reading: Html Starting Code
The start attribute can be useful when you need to create a list that starts from a specific number. It's a simple way to customize the numbering of your ordered list.
Here are some examples of how to use the start attribute:
You can use the start attribute to create a list that starts from a specific number or letter, making it a useful tool for customizing your ordered lists.
Basic Example of Ordered Lists
Ordered lists are a great way to present information in a logical and easy-to-follow manner. They use numbers to indicate the order of items, making it simple for readers to understand the sequence.
To create an ordered list, you start with a numbered list, like this: 1. Item one, 2. Item two, 3. Item three.
The numbers are automatically incremented when you add new items, so you don't have to worry about keeping track of them.
On a similar theme: Html List Item
Creating Unordered Lists
Creating unordered lists is a great way to present items that don't need to be in any specific order.
These lists are used for items that don't need to be in any specific order, and are typically marked with bullets. You can see an example of an unordered list in the article section "HTML Lists" where it's used to list various HTML topics.
To create an unordered list, you can use the tag. For example, the article section "HTML Introduction" is listed in an unordered list.
A unique perspective: Lists Html
Types of Unordered Lists
Creating unordered lists is a great way to present information in a clear and concise manner. You can customize the type of bullet used to represent each list item.
There are four main values of the list-style property that help us with this customization: none, circle, disc, and square. These values determine the type of bullet that appears in front of the list item.
Curious to learn more? Check out: Html Bullet Points
The default value is disc, which is a filled circular bullet. You can use the circle value to get a hollow circular bullet, or the square value to get a filled square bullet.
Here's a breakdown of the different list-style values:
List Markup and Structure
If you're working with ordered lists, you can mark them up using the li element. This is how you create a list that displays numbers or letters.
To clear your work, you can use the Reset button in the MDN Playground if you make a mistake.
Lit Node 1: Markup
You can clear your work using the Reset button in the MDN Playground if you make a mistake. This feature is super helpful when you're experimenting with different code snippets.
If you get really stuck, you can view the solution below the code block.
Lit-Node Nesting
Nesting lists is perfectly OK, and it's a great way to have sub-bullets sitting below a top-level bullet.
Additional reading: Html Tag B
You might want to nest sub-instructions or choices below a main bullet, like we saw in the recipe example.
The second list from the recipe example is a good illustration of this - the last two bullets are closely related to the one before them.
Try going back to the previous task and updating the second list like this: nest the sub-bullets inside their own unordered list and put that list inside the main bullet.
You might enjoy: Creating Horizontal List with Bullets in Html
Best Practices for Lists
Unordered lists should be used for short items, like the example of technologies we use: HTML, CSS, and JavaScript. Each item should be concise, making it easy to scan.
Semantic correctness is key, so choose the right type of list for your content. This ensures your list is not only visually appealing but also accessible to screen readers.
Lists can be nested inside one another, creating a hierarchy. For instance, placing an unordered list inside an ordered list item can help organize complex information.
Use CSS to style your lists, changing bullet styles in unordered lists or numbering styles in ordered lists. This helps match your website's design and enhances user experience.
Properly structured lists improve accessibility, making it easier for screen readers to interpret content.
If this caught your attention, see: Styling Html Lists
List Types and Uses
Unordered lists are ideal for scenarios where the sequence of the items is not important. They are marked with bullets, also known as bulleted lists.
An unordered list starts with the tag, and each list item begins with the tag. You can customize the appearance of the list by using the compact and type attributes.
For example, the compact attribute renders the list smaller, while the type attribute specifies which kind of marker is used in the list.
There are three main types of lists in HTML: unordered lists, ordered lists, and description lists. Unordered lists are used for items that do not need to be in any specific order.
Here are the main values of the list-style property that help us customize unordered lists:
You can use different types of unordered lists, such as using lower case letters like a as the type value to list the elements with a, b, c, and so on.
Ordered lists are used when the items need to follow a specific sequence. They are typically marked with numbers by default, but you can customize the appearance by using attributes such as type, start, and reversed.
For example, you can use the type attribute to specify which type of order you want in your list, such as numeric, alphabetic, or roman numbers.
Curious to learn more? Check out: Html Input Only Numbers
Featured Images: pexels.com


