Nav tabs are a Bootstrap component that creates a horizontal menu with clickable tabs to switch between different content sections without reloading the page.
Click to reveal answer
beginner
How do nav pills differ visually from nav tabs?
Nav pills have rounded edges and look like buttons, while nav tabs have square edges and look like traditional tabs. Both serve to switch content but have different styles.
Click to reveal answer
beginner
Which Bootstrap class is used to create a nav container for tabs or pills?
The class nav is used as the base container. Then add nav-tabs for tabs or nav-pills for pills styling.
Click to reveal answer
beginner
How do you mark a tab or pill as active in Bootstrap?
Add the class active to the <li> or <a> element representing the tab or pill to show it as selected.
Click to reveal answer
intermediate
What role do data-bs-toggle="tab" attributes play in Bootstrap nav tabs?
They enable the tab switching behavior by telling Bootstrap JavaScript to show the linked tab content when the tab is clicked.
Click to reveal answer
Which class creates a Bootstrap nav container styled as tabs?
Anav-pills
Bnav-tabs
Cnav-buttons
Dnav-list
✗ Incorrect
The class nav-tabs styles the nav container as tabs.
What class do you add to a nav item to show it as active?
Aactive
Bcurrent
Cselected
Dhighlight
✗ Incorrect
The active class marks the tab or pill as selected.
Which attribute enables tab switching behavior in Bootstrap nav tabs?
Adata-bs-toggle="tab"
Bdata-toggle="pill"
Cdata-switch="nav"
Ddata-nav="active"
✗ Incorrect
data-bs-toggle="tab" tells Bootstrap to switch tab content on click.
How do nav pills visually differ from nav tabs?
APills have square edges, tabs have rounded edges
BPills use icons, tabs use text
CPills have rounded edges, tabs have square edges
DPills are vertical, tabs are horizontal
✗ Incorrect
Nav pills have rounded edges like buttons; tabs have square edges.
Which HTML element usually contains the nav items in Bootstrap nav tabs?
A<footer>
B<section>
C<div>
D<ul>
✗ Incorrect
A
list is commonly used to hold nav items.
Explain how to create a basic Bootstrap nav tabs component and how it works.
Think about the HTML structure and Bootstrap classes needed.
You got /5 concepts.
Describe the visual and functional differences between nav tabs and nav pills in Bootstrap.
Focus on style and usage differences.
You got /5 concepts.
Practice
(1/5)
1. What is the main difference between nav-tabs and nav-pills in Bootstrap navigation?
easy
A. nav-tabs requires JavaScript, nav-pills does not.
B. nav-tabs shows tabs with borders, nav-pills shows rounded pill-shaped links.
C. nav-tabs is for vertical menus, nav-pills is for horizontal menus only.
D. nav-tabs disables links, nav-pills enables links.
Solution
Step 1: Understand Bootstrap navigation styles
nav-tabs creates a tab-like navigation with rectangular borders around each item.
Step 2: Compare with nav-pills
nav-pills styles navigation links as rounded pills, giving a softer look.
Final Answer:
nav-tabs shows tabs with borders, nav-pills shows rounded pill-shaped links. -> Option B
Quick Check:
Tabs = rectangular, Pills = rounded [OK]
Hint: Tabs have edges, pills are rounded shapes [OK]
Common Mistakes:
Thinking nav-tabs are vertical only
Believing nav-pills don't need JS
Confusing disabled/enabled states
2. Which of the following is the correct Bootstrap class to create a pill-style navigation list?
easy
A. <ul class='nav-tabs'>
B. <ul class='nav nav-tabs-pills'>
C. <ul class='nav nav-pills'>
D. <ul class='nav pills'>
Solution
Step 1: Recall Bootstrap classes for pills
The correct class for pill navigation is nav-pills combined with nav.
Step 2: Check each option
<ul class='nav nav-pills'> uses nav nav-pills, which is correct. Others have incorrect or non-existent classes.
Final Answer:
<ul class='nav nav-pills'> -> Option C
Quick Check:
Use nav nav-pills for pills [OK]
Hint: Use both 'nav' and 'nav-pills' classes together [OK]
Common Mistakes:
Using only 'pills' without 'nav'
Combining 'nav-tabs' and 'pills' incorrectly
Misspelling class names
3. Given this Bootstrap nav tab code snippet, what will be the visual result in the browser?
A. The attribute data-toggle should be data-bs-toggle in Bootstrap 5+.
B. The class nav-pills is invalid and should be nav-tabs.
C. The href attributes must be full URLs, not fragment IDs.
D. The nav-item class should be on the a tags, not li.
Solution
Step 1: Check Bootstrap version attribute changes
Bootstrap 5 replaced data-toggle with data-bs-toggle for JavaScript plugins.
Step 2: Verify other attributes and classes
nav-pills is valid, href can use fragment IDs, and nav-item belongs on li.
Final Answer:
The attribute data-toggle should be data-bs-toggle in Bootstrap 5+. -> Option A
Quick Check:
Use 'data-bs-toggle' in Bootstrap 5+ [OK]
Hint: Bootstrap 5 uses 'data-bs-toggle' not 'data-toggle' [OK]
Common Mistakes:
Using old Bootstrap 4 attributes
Misplacing classes on wrong elements
Thinking href must be full URL
5. You want to create a responsive Bootstrap nav with pills that switch content panels on click. Which combination of classes and attributes is correct to ensure accessibility and proper tab switching?