Here are Top 20 Bootstrap Interview Questions and Answers that will help you prepare for technical interviews related to frontend development using Bootstrap:
🧠1. What is Bootstrap and what are its key features?
Answer:
Bootstrap is a front-end framework for developing responsive and mobile-first websites.
Key Features:
- Grid system
- Predefined CSS classes
- JavaScript components
- Customizable via Sass variables
- Cross-browser compatibility
🧠2. What is the difference between Bootstrap 4 and Bootstrap 5?
Answer:
Feature | Bootstrap 4 | Bootstrap 5 |
---|---|---|
jQuery | Required | Removed |
Grid System | Uses .xl , .lg , etc. | Adds .xxl , improved grid |
Forms | Less customizable | Enhanced forms with utility classes |
Utility API | Limited | Utility API with extendable utilities |
Icons | No built-in icons | Recommends using Bootstrap Icons |
🧠3. What is the Bootstrap grid system?
Answer:
Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s based on Flexbox and has 12 columns by default.
Example:
<div class="row">
<div class="col-md-6">Left</div>
<div class="col-md-6">Right</div>
</div>
🧠4. What are Bootstrap breakpoints?
Answer:
Bootstrap uses responsive breakpoints for mobile-first design:
xs
<576px (no class)sm
≥576pxmd
≥768pxlg
≥992pxxl
≥1200pxxxl
≥1400px
Top 20 Bootstrap Interview Questions and Answers
🧠5. Explain Bootstrap utility classes with examples.
Answer:
Utility classes are single-purpose helper classes for common styling:
m-3
: margin on all sidesp-2
: padding on all sidestext-center
: center-align textd-flex
,justify-content-between
: Flexbox utilities
🧠6. How does the .container
class differ from .container-fluid
?
Answer:
.container
: Fixed width at each breakpoint.container-fluid
: 100% width across all breakpoints
🧠7. How to customize Bootstrap using Sass?
Answer:
You can override Bootstrap Sass variables before importing Bootstrap:
$primary: #ff5722;
@import "bootstrap";
You must set up a Sass compiler like Dart Sass or Webpack.
🧠8. How do you make a responsive navbar in Bootstrap?
Answer:
Use navbar-expand-{breakpoint}
with toggle button and collapse class:
<nav class="navbar navbar-expand-md navbar-light bg-light">
<a class="navbar-brand" href="#">Brand</a>
<button class="navbar-toggler" ...></button>
<div class="collapse navbar-collapse" id="navbarNav">...</div>
</nav>
🧠9. What is the use of the order
and offset
classes in Bootstrap?
Answer:
order-{1-12}
: Changes column order in flex containersoffset-{breakpoint}-{1-11}
: Adds margin before a column
🧠10. What are Bootstrap cards?
Answer:
Cards are flexible containers for content with options like:
<div class="card">
<img src="..." class="card-img-top">
<div class="card-body">
<h5 class="card-title">Title</h5>
<p class="card-text">Text</p>
</div>
</div>
🧠11. How do modals work in Bootstrap?
Answer:
Bootstrap modals are pop-up dialogs triggered via JavaScript or data attributes:
<button data-bs-toggle="modal" data-bs-target="#exampleModal">Open</button>
<div class="modal fade" id="exampleModal" tabindex="-1">...</div>
Top 20 Bootstrap Interview Questions and Answers
🧠12. Explain the d-*
(Display) utility classes.
Answer:
Used to toggle display properties:
d-none
:display: none
d-block
:display: block
d-flex
,d-inline-flex
, etc.
🧠13. How do you implement tooltips and popovers in Bootstrap?
Answer:
They require JavaScript initialization:
<button data-bs-toggle="tooltip" title="Tooltip text">Hover me</button>
<script>
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
tooltipTriggerList.map(el => new bootstrap.Tooltip(el));
</script>
🧠14. What is Bootstrap’s Accordion component?
Answer:
An accordion allows collapsing and expanding content:
<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header"><button class="accordion-button" data-bs-toggle="collapse">Item</button></h2>
<div class="accordion-collapse collapse show" data-bs-parent="#accordionExample">...</div>
</div>
</div>
🧠15. What are media objects in Bootstrap?
Answer:
Used to align media (like images) with content:
<div class="media">
<img src="..." class="mr-3" alt="...">
<div class="media-body">Text</div>
</div>
Top 20 Bootstrap Interview Questions and Answers
🧠16. How do you use Bootstrap Carousel?
Answer:
A slideshow component for cycling through elements:
<div id="carouselExample" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active"><img src="..."></div>
<div class="carousel-item"><img src="..."></div>
</div>
<a class="carousel-control-prev" ...></a>
<a class="carousel-control-next" ...></a>
</div>
🧠17. What is the Bootstrap Reboot?
Answer:
Bootstrap Reboot is a modified version of Normalize.css that sets consistent cross-browser styles for HTML elements.
🧠18. Can you create custom Bootstrap themes?
Answer:
Yes. You can create themes by:
- Overriding Sass variables
- Adding custom CSS
- Using tools like Bootstrap Theme Builder
🧠19. How does Bootstrap’s form validation work?
Answer:
Bootstrap provides visual feedback using validation classes:
<form class="was-validated">
<input class="form-control is-valid" required>
</form>
🧠20. What are the best practices when using Bootstrap in production?
Answer:
- Use the minified version of Bootstrap
- Purge unused CSS for performance
- Customize with Sass for consistency
- Avoid deep nesting of grid
- Use ARIA roles for accessibility
Top 20 Bootstrap Interview Questions and Answers
Table of Contents
Top 20 Bootstrap Interview Questions and Answers
Top 20 Bootstrap Interview Questions and Answers
2 comments
[…] Top 20 Bootstrap Interview Questions and Answers […]
[…] Top 20 Bootstrap Interview Questions and Answers […]