📖 Scenario: You are building a simple webpage to display a list of tasks using Bootstrap's list group component. This will help users see their tasks clearly and in a styled manner.
🎯 Goal: Create a Bootstrap list group with exactly four list items showing the tasks: 'Buy groceries', 'Call mom', 'Finish homework', and 'Read a book'.
📋 What You'll Learn
Use Bootstrap 5 classes for the list group
Create an unordered list with the class list-group
Add four list items with the class list-group-item
Each list item must contain the exact text for the tasks given
Include the basic HTML5 document structure with lang, charset, and viewport meta tags
💡 Why This Matters
🌍 Real World
List groups are commonly used in websites and apps to show lists of items like tasks, messages, or notifications in a clean and organized way.
💼 Career
Knowing how to use Bootstrap components like list groups helps you quickly build professional-looking user interfaces that are responsive and accessible.
Progress0 / 4 steps
1
Create the HTML skeleton
Write the basic HTML5 document structure with lang="en", charset="UTF-8", and the viewport meta tag for responsive design.
Bootsrap
Hint
Remember to include <!DOCTYPE html> at the top and set the language to English.
2
Add Bootstrap CSS link
Inside the <head> section, add the Bootstrap 5 CSS CDN link to enable Bootstrap styles.
Bootsrap
Hint
Use the official Bootstrap 5 CDN link for CSS inside the <head> tag.
3
Create the list group with tasks
Inside the <body>, create an unordered list with the class list-group. Add four list items with the class list-group-item containing the exact texts: Buy groceries, Call mom, Finish homework, and Read a book.
Bootsrap
Hint
Use <ul> with class list-group and inside it add four <li> elements with class list-group-item.
4
Add accessibility and container
Wrap the list group inside a <main> element with role="main" for accessibility. Also, add a Bootstrap container <div class="container mt-4"> around the <main> to center content with margin top spacing.
Bootsrap
Hint
Use a <div> with classes container mt-4 and inside it a <main> with role="main" wrapping the list.
Practice
(1/5)
1. What is the main purpose of the Bootstrap list-group component?
easy
A. To organize and style a list of items cleanly
B. To create a navigation bar
C. To add buttons with icons
D. To display images in a grid
Solution
Step 1: Understand the role of list-group
The list-group component is designed to group related items in a list format.
Step 2: Compare with other components
Unlike navigation bars or grids, list-group focuses on listing items with consistent styling.
Final Answer:
To organize and style a list of items cleanly -> Option A
Quick Check:
List groups = styled item lists [OK]
Hint: Remember list groups are for clean lists, not nav or grids [OK]
Common Mistakes:
Confusing list group with navigation bar
Thinking it creates buttons or grids
Mixing it with image display components
2. Which of the following is the correct way to start a Bootstrap list group in HTML?
easy
A.
B.
C.
D.
Solution
Step 1: Identify the container class for list groups
Bootstrap requires the container to have the class list-group to apply styles.
Step 2: Choose the correct HTML element
Commonly, <ul> or <div> with list-group is used; here <ul> with class list-group is correct.
Final Answer:
<ul class="list-group"> -> Option C
Quick Check:
Use <ul> with class list-group [OK]
Hint: Use <ul> or <div> with class list-group to start [OK]
Common Mistakes:
Using wrong class names like list-item or group-list
Bootstrap uses <a> tags with classes list-group-item and list-group-item-action for clickable items.
Step 2: Check other options
<ul class="list-group">
<li class="list-group-item">Item 1</li>
<li class="list-group-item">Item 2</li>
</ul> uses non-clickable <li>, A misses list-group-item-action, D uses li without proper container and classes.
Final Answer:
Div with <a> tags having list-group-item and list-group-item-action classes -> Option D
Quick Check:
Clickable list items = <a> + list-group-item-action [OK]
Hint: Clickable list items use <a> with list-group-item-action class [OK]
Common Mistakes:
Using <li> without action class for clickable items
Missing list-group-item-action class
Using buttons without proper classes
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.