📖 Scenario: You want to create a simple webpage that shows a list of your top 3 favorite fruits in order.
🎯 Goal: Build a webpage with an ordered list showing exactly three fruits in the correct order.
📋 What You'll Learn
Use semantic HTML5 structure with <main> and <section> tags
Create an ordered list with exactly three items
Each list item must contain the exact fruit names: Apple, Banana, Cherry
Ensure the HTML document includes lang, charset, and viewport meta tags for accessibility and responsiveness
💡 Why This Matters
🌍 Real World
Ordered lists are used on websites to show steps, rankings, or any information that needs to be in a specific order, like instructions or top lists.
💼 Career
Knowing how to create accessible and semantic ordered lists is essential for web developers to build user-friendly and well-structured websites.
Progress0 / 4 steps
1
Set up the basic HTML structure
Create a basic HTML5 document structure with lang="en" in the <html> tag, and include <head> with <meta charset="UTF-8"> and <meta name="viewport" content="width=device-width, initial-scale=1.0">. Add an empty <body> section.
HTML
Hint
Remember to start with <!DOCTYPE html> and set the language attribute in the <html> tag.
2
Add main and section elements
Inside the <body>, add a <main> element. Inside <main>, add a <section> element with a heading <h1> that says "My Favorite Fruits".
HTML
Hint
Use semantic tags to organize your content. The heading should be inside the section.
3
Create the ordered list
Inside the <section>, add an ordered list <ol> with three list items <li>. The items must be exactly: Apple, Banana, and Cherry in that order.
HTML
Hint
Use <ol> for ordered lists and <li> for each item.
4
Add accessibility and finalize
Add an aria-label="Favorite fruits list" attribute to the <ol> element to improve accessibility. Make sure the entire HTML document is complete and well-structured.
HTML
Hint
Adding aria-label helps screen readers understand the list better.
Practice
(1/5)
1. What HTML tag is used to create a numbered list?
easy
A. <ol>
B. <ul>
C. <li>
D. <list>
Solution
Step 1: Understand list types in HTML
There are two main list types: ordered (<ol>) and unordered (<ul>).
Step 2: Identify the tag for numbered lists
The <ol> tag creates numbered (ordered) lists, while <ul> creates bullet lists.
Final Answer:
<ol> -> Option A
Quick Check:
Numbered list tag = <ol> [OK]
Hint: Numbered lists always use <ol> tag [OK]
Common Mistakes:
Confusing <ol> with <ul>
Using <li> as the list container
Trying to use a non-existent <list> tag
2. Which of the following is the correct syntax to start an ordered list in HTML?
easy
A. <orderedlist>
B. <list type='number'>
C. <ol>
D. <ul type='1'>
Solution
Step 1: Recall standard HTML tags for lists
The standard tag for ordered lists is <ol>. Other tags like <orderedlist> or attributes on <ul> are not valid HTML.
Step 2: Confirm correct syntax
The correct way to start an ordered list is simply <ol> without extra attributes or incorrect tag names.
Final Answer:
<ol> -> Option C
Quick Check:
Correct ordered list tag = <ol> [OK]
Hint: Ordered lists start with <ol>, no extra attributes needed [OK]
Common Mistakes:
Using non-standard tags like <orderedlist>
Adding type attribute to <ul> for numbers
Confusing <ul> and <ol> tags
3. What will be the visual output of this HTML code?