What does the <code>.table-striped</code> class do in a Bootstrap table?
It adds alternating background colors to the table rows, making it easier to read across rows.
Click to reveal answer
beginner
What effect does the <code>.table-hover</code> class add to a Bootstrap table?
It highlights a table row with a background color when you move your mouse pointer over it.
Click to reveal answer
beginner
How do you combine striped rows and hover effect in a Bootstrap table?
Add both .table-striped and .table-hover classes to the <table> element.
Click to reveal answer
beginner
Why is using striped and hover tables helpful for users?
Striped rows help users follow data across the table easily, and hover effect shows which row is currently focused, improving readability and navigation.
Click to reveal answer
beginner
Which HTML element should have the Bootstrap classes .table-striped and .table-hover applied?
The <table> element itself should have these classes to style all its rows properly.
Click to reveal answer
Which Bootstrap class adds alternating background colors to table rows?
A.table-hover
B.table-responsive
C.table-bordered
D.table-striped
✗ Incorrect
The .table-striped class adds alternating background colors to rows.
What does the .table-hover class do in a Bootstrap table?
AHighlights a row on mouse hover
BAdds borders around the table
CMakes the table responsive
DChanges font size
✗ Incorrect
The .table-hover class highlights a row when you hover the mouse over it.
How do you apply both striped rows and hover effect to a Bootstrap table?
AAdd .table-hover only
BAdd both .table-striped and .table-hover classes
CAdd .table-striped only
DAdd .table-bordered
✗ Incorrect
You add both .table-striped and .table-hover classes to get both effects.
Where should you add the .table-striped and .table-hover classes?
AOn each <tr> element
BOn the <td> elements
COn the <table> element
DOn the <tbody> element
✗ Incorrect
These classes are added to the
element to style all rows.
Why are striped and hover effects useful in tables?
AThey improve readability and user focus
BThey change font colors
CThey add animations
DThey make tables smaller
✗ Incorrect
Striped rows and hover effects help users read and focus on table data easily.
Explain how to create a Bootstrap table with both striped rows and hover effect. Include which classes to use and where to apply them.
Think about the classes that control row colors and mouse interaction.
You got /3 concepts.
Describe why using striped and hover effects in tables helps users when reading data.
Consider how visual cues help eyes track information.
You got /3 concepts.
Practice
(1/5)
1. What does the table-striped class do in a Bootstrap table?
easy
A. Adds alternating background colors to table rows for easier reading.
B. Highlights the row when you hover the mouse over it.
C. Makes the table borders thicker.
D. Changes the font style of the table text.
Solution
Step 1: Understand the purpose of table-striped
The table-striped class adds alternating background colors to rows, making it easier to read data across the table.
Step 2: Differentiate from other classes
The table-hover class highlights rows on mouse hover, which is different from table-striped.
Final Answer:
Adds alternating background colors to table rows for easier reading. -> Option A
Quick Check:
Striped = alternating row colors [OK]
Hint: Striped means alternating colors on rows [OK]
Common Mistakes:
Confusing striped with hover effect
Thinking it changes font or borders
Assuming it highlights on mouse hover
2. Which is the correct way to add both striped and hover effects to a Bootstrap table?
easy
A. <table class='table-striped-hover'>
B. <table class='table-hover table-striped'>
C. <table class='striped hover'>
D. <table class='table table-striped table-hover'>
Solution
Step 1: Check Bootstrap class syntax
Bootstrap requires the base table class plus additional classes separated by spaces, like table-striped and table-hover.
Step 2: Validate correct class order and spelling
<table class='table table-striped table-hover'> correctly uses class='table table-striped table-hover'. Order doesn't matter but all classes must be present and spelled correctly.
Final Answer:
<table class='table table-striped table-hover'> -> Option D
Quick Check:
Use base table plus both classes [OK]
Hint: Always include base 'table' class with modifiers [OK]
Common Mistakes:
Omitting the base 'table' class
Combining classes without spaces
Using incorrect class names
3. Given this HTML snippet, what visual effect will the table have?
C. The class should be table-hover, not just hover.
D. Hover effect requires JavaScript to work.
Solution
Step 1: Check class names
The class hover alone is not a valid Bootstrap class for hover effect.
Step 2: Correct class for hover effect
The correct class is table-hover, which must be used with the base table class.
Final Answer:
The class should be table-hover, not just hover. -> Option C
Quick Check:
Hover effect needs table-hover class [OK]
Hint: Hover class must be 'table-hover' exactly [OK]
Common Mistakes:
Using 'hover' instead of 'table-hover'
Omitting 'table' base class
Assuming hover needs JavaScript
5. You want a table that has striped rows, highlights on hover, and also makes the header row stand out with a dark background. Which is the best way to achieve this using Bootstrap classes?
hard
A. <table class='table table-striped table-hover'> <thead class='table-header-dark'> ... </thead> </table>
B. <table class='table table-striped table-hover'> <thead class='table-dark'> ... </thead> </table>
C. <table class='table table-striped table-hover'> <thead class='thead-dark'> ... </thead> </table>
D. <table class='table table-striped table-hover table-dark'> ... </table>
Solution
Step 1: Combine striped and hover classes on table
Use table-striped and table-hover with the base table class for row effects.
Step 2: Use correct class for dark header
Bootstrap uses table-dark on the <thead> element to style the header with a dark background.
Step 3: Verify other options
table-dark on the whole table changes entire table style, not just header. thead-dark is deprecated in Bootstrap 5+. table-header-dark is not a valid class.