Difficulty: Easy
Correct Answer: .navbar-inverse
Explanation:
Introduction / Context:
Bootstrap is a popular front end framework that provides ready made components, including navigation bars. Earlier versions of Bootstrap differentiate between the default light navigation bar and an inverse, darker one. This question checks whether you know the correct CSS class used to apply the black or dark style in those versions, which is useful knowledge in many web design and front end interviews.
Given Data / Assumptions:
Concept / Approach:
In Bootstrap 3, navbars are styled using CSS classes such as navbar default for a light themed bar and navbar inverse for a dark themed bar. The class navbar inverse applies a dark background with light text, which most people describe as a black navigation bar. Other class names in the options either do not exist in that version or refer to other concepts. Therefore, the correct answer must be the well known navbar inverse class.
Step-by-Step Solution:
1. Recall the standard Bootstrap 3 syntax for a navigation bar: <nav class="navbar navbar-default"> ... </nav> for the default style.
2. Remember that to get a dark or black navbar, you replace navbar-default with navbar-inverse while keeping the navbar base class.
3. Check the options for the exact class name navbar-inverse.
4. Confirm that this class name corresponds to the dark theme in Bootstrap documentation and examples.
5. Select navbar-inverse as the correct answer.
Verification / Alternative check:
If you have used Bootstrap before, you can mentally picture a simple example where changing the class from navbar-default to navbar-inverse immediately changes the visual appearance to a dark bar. Additionally, you might recall that examples on many tutorial websites use navbar-inverse to show a black menu. No commonly used Bootstrap class named navbar-black exists, which further confirms that navbar-inverse is the correct option.
Why Other Options Are Wrong:
Common Pitfalls:
A pitfall is mixing up class names from different Bootstrap versions. For example, Bootstrap 4 and later use different styling approaches, and developers may incorrectly apply modern class names to older code. Another mistake is assuming intuitive class names like navbar-black exist simply from their wording, when in fact frameworks often choose more generic names like inverse. Always consult version specific documentation when you are unsure.
Final Answer:
The correct answer is .navbar-inverse, because in classic Bootstrap navbars this class applies the black or dark theme instead of the default light appearance.
Discussion & Comments