BootstrapBootstrapbeginner

Bootstrap Interview Questions for Freshers

25 Bootstrap questions for front-end fresher interviews and vivas: grid, rows and columns, containers, breakpoints, spacing and display utilities, flexbox helpers, forms and components, with short answers.

Published
TL;DR – Quick Answer

Bootstrap fresher interviews focus on the 12-column grid, containers, rows and columns, the breakpoints sm, md, lg, xl and xxl, utility classes for spacing and display, and common components such as the navbar, cards and modals. Be ready to write the HTML for a responsive three-column layout from memory.

On This Page

Bootstrap interview questions for freshers test whether you can build a responsive page quickly. Expect questions on the grid system, containers, breakpoints, utility classes and common components. This page has 25 questions with short answers and HTML you can try in the online HTML, CSS and JS editor.

Examples use Bootstrap 5. Class names differ in places from Bootstrap 4, and the answers point out the main changes.

How to answer Bootstrap interview questions

Answer with the class, what it does and when it changes. "col-md-4 makes a column one third wide from the md breakpoint, 768 pixels, upward. Below that it is full width, so the cards stack on a phone."

Pro tip: Most Bootstrap rounds end with "build this layout". Practise a navbar, a three-card row and a form until you can write them without the docs.

Bootstrap basics questions

Q1. What is Bootstrap?

30-second answer: Bootstrap is a free, open-source CSS framework for building responsive, mobile-first websites. It gives a grid system, ready-made components such as navbars, cards and modals, and utility classes for spacing, colours and layout. It was created at Twitter and released in 2011.

Q2. How do you add Bootstrap to a page?

30-second answer: Link the CSS in the <head> and the JavaScript bundle before </body>, from a CDN or from files installed with npm install bootstrap. The viewport meta tag is needed for responsive behaviour.

<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
...
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

Check the official Bootstrap site for the latest version number. The bundle file includes Popper, which dropdowns, tooltips and popovers need.

Q3. What does mobile-first mean in Bootstrap?

30-second answer: Styles are written for small screens first, and larger screens add changes with min-width media queries. A class without a breakpoint, such as col-12, applies to all sizes. A class with a breakpoint, such as col-md-6, applies from that size upward.

Q4. What changed from Bootstrap 4 to Bootstrap 5?

Change Bootstrap 4 Bootstrap 5
jQuery Required for JavaScript components Not needed, plain JavaScript
Breakpoints xs to xl Adds xxl (1400px and up)
Left and right classes ml-3, mr-3, float-left ms-3, me-3, float-start
Data attributes data-toggle data-bs-toggle
Internet Explorer Supported (IE 10 and 11) Not supported
Gutter control no-gutters only g-0 to g-5, gx-*, gy-*

30-second answer: Bootstrap 5 dropped jQuery and Internet Explorer, added the xxl breakpoint and renamed left and right to start and end so layouts work for right-to-left languages.

Grid system questions

Q5. How does the Bootstrap grid system work?

30-second answer: The grid divides a row into 12 columns. You place columns inside a row and rows inside a container. Each column says how many of the 12 parts it takes. The grid is built with flexbox.

<div class="container">
  <div class="row">
    <div class="col-md-8">Main content</div>
    <div class="col-md-4">Sidebar</div>
  </div>
</div>

From 768px up, the main content takes 8 of 12 parts and the sidebar 4. Below that, both are full width and stack.

Q6. What are the Bootstrap 5 breakpoints?

Breakpoint Class infix Applies from
Extra small none Below 576px
Small sm 576px
Medium md 768px
Large lg 992px
Extra large xl 1200px
Extra extra large xxl 1400px

30-second answer: Learn these six. A class such as col-lg-3 applies from 992px upward unless a larger breakpoint class overrides it.

Q7. How do you make a layout with 1, 2 and 4 columns on phone, tablet and desktop?

<div class="row">
  <div class="col-12 col-sm-6 col-lg-3">Card 1</div>
  <div class="col-12 col-sm-6 col-lg-3">Card 2</div>
  <div class="col-12 col-sm-6 col-lg-3">Card 3</div>
  <div class="col-12 col-sm-6 col-lg-3">Card 4</div>
</div>

30-second answer: Stack the classes. col-12 is full width on phones, col-sm-6 gives two per row from 576px and col-lg-3 gives four per row from 992px. The same result can be written on the row with row-cols-1 row-cols-sm-2 row-cols-lg-4.

Q8. What happens if the columns in a row add up to more than 12?

30-second answer: The extra columns wrap onto a new line. For example, col-8 and col-6 in one row put the second column on the next line, because 8 + 6 is 14.

Q9. What is the difference between col, col-6 and col-auto?

30-second answer: col shares the free space equally with other col columns. col-6 takes exactly half the row. col-auto is only as wide as its content.

Q10. What are offsets, ordering and gutters?

30-second answer: offset-md-2 pushes a column right by 2 columns from md upward. order-first, order-last and order-1 to order-5 change the visual order without changing the HTML. Gutters are the gaps between columns, controlled with g-0 to g-5, or gx-* and gy-* for one direction.

Q11. How do you nest columns?

30-second answer: Put a new row inside a column, then add columns to that row. The inner row again has 12 columns, measured across the width of its parent column.

<div class="row">
  <div class="col-md-8">
    <div class="row">
      <div class="col-6">Inner left</div>
      <div class="col-6">Inner right</div>
    </div>
  </div>
</div>

Container questions

Q12. What is the difference between .container and .container-fluid?

Class Width
.container Fixed maximum width that changes at each breakpoint, centred
.container-fluid Always 100% of the screen width
.container-md 100% wide until md, then behaves like .container

30-second answer: .container keeps content in a centred box with a maximum width. .container-fluid stretches edge to edge. Breakpoint containers such as .container-lg are a mix of the two.

Q13. Why must columns be inside a row?

30-second answer: The row is the flex container that lines columns up side by side, and it uses negative margins to balance the padding (gutters) on the columns. Putting columns straight inside a container breaks the alignment and spacing.

Utility class questions

Q14. How do spacing utilities work?

30-second answer: The pattern is {property}{side}-{size}. Property is m for margin or p for padding. Side is t, b, s (start), e (end), x (left and right), y (top and bottom) or blank for all sides. Size is 0 to 5 or auto.

Class Meaning
mt-3 Margin top, size 3
px-4 Padding left and right, size 4
mb-0 No bottom margin
mx-auto Centre a block that has a width
p-md-5 Padding size 5 from md upward

Q15. How do you hide or show an element on certain screen sizes?

30-second answer: Use display utilities with breakpoints. d-none hides, and d-{breakpoint}-block shows from that size.

<div class="d-none d-md-block">Shown from tablet up</div>
<div class="d-md-none">Shown only on phones</div>

Q16. Which flexbox utilities does Bootstrap provide?

30-second answer: d-flex makes a flex container. justify-content-between, justify-content-center and similar set horizontal alignment, align-items-center sets vertical alignment, flex-column stacks items and gap-3 adds space between them.

<div class="d-flex justify-content-between align-items-center">
  <span>Logo</span>
  <button class="btn btn-primary">Login</button>
</div>

The CSS flexbox guide explains the properties behind these classes.

Q17. What colour and text utilities do you use?

30-second answer: Theme colours are primary, secondary, success, danger, warning, info, light and dark. They appear in classes such as text-danger, bg-light and btn-success. Text classes include text-center, text-md-start, fw-bold, fs-4 and text-truncate.

Q18. How do you make an image responsive?

30-second answer: Add img-fluid. It sets max-width: 100% and height: auto, so the image shrinks with its container and keeps its shape. rounded and rounded-circle round the corners.

Component questions

Q19. Which Bootstrap components have you used?

Component Used for
Navbar Responsive top menu that collapses on phones
Card Box with image, title, text and buttons
Modal Pop-up dialog
Alert Message boxes such as success and error
Buttons and button groups Styled actions
Carousel Image slider
Accordion Collapsible sections
Badge, toast, spinner Small status elements

30-second answer: Name three you used in a project and what each did, such as a navbar, product cards and a confirm-delete modal.

Q20. How does a responsive navbar collapse on mobile?

<nav class="navbar navbar-expand-lg bg-body-tertiary">
  <div class="container">
    <a class="navbar-brand" href="#">Brand</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
            data-bs-target="#mainNav" aria-controls="mainNav"
            aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="mainNav">
      <ul class="navbar-nav ms-auto">
        <li class="nav-item"><a class="nav-link" href="#">Home</a></li>
        <li class="nav-item"><a class="nav-link" href="#">Courses</a></li>
      </ul>
    </div>
  </div>
</nav>

30-second answer: navbar-expand-lg shows the full menu from 992px up. Below that, the links are hidden in a collapse element, and the toggler button opens it using data-bs-toggle and data-bs-target. The bundle JavaScript must be loaded.

Q21. How do you open a modal?

30-second answer: Give a button data-bs-toggle="modal" and data-bs-target="#modalId", matching the id of a .modal element. You can also open it from JavaScript with bootstrap.Modal.getOrCreateInstance(element).show().

Q22. Why don't tooltips work just by adding the attribute?

30-second answer: Tooltips and popovers are opt-in for performance, so you must start them with JavaScript, and they need Popper, which is included in bootstrap.bundle.min.js.

document.querySelectorAll('[data-bs-toggle="tooltip"]')
  .forEach(el => new bootstrap.Tooltip(el));

Q23. How do you style forms in Bootstrap?

30-second answer: Use form-label for labels, form-control for inputs and textareas, form-select for dropdowns and form-check with form-check-input for checkboxes and radios. For validation, add is-valid or is-invalid to a field and a valid-feedback or invalid-feedback message after it.

<label for="email" class="form-label">Email</label>
<input type="email" class="form-control is-invalid" id="email">
<div class="invalid-feedback">Enter a valid email.</div>

Customisation questions

Q24. How do you customise Bootstrap's look?

30-second answer: The simple way is your own CSS file loaded after Bootstrap. The better way is to use Bootstrap's Sass source and change variables such as $primary before importing it, so every component uses your colours. Bootstrap 5 also exposes CSS variables, such as --bs-primary, for some values.

Avoid editing bootstrap.min.css directly, because updates will overwrite your changes.

Q25. What are the disadvantages of Bootstrap?

30-second answer: Sites can look alike if you do not customise them. You may load CSS and JavaScript you never use, unless you build only the parts you need. Long chains of utility classes can make HTML harder to read. It also hides how CSS works, so beginners should learn plain CSS too. The CSS interview questions page covers what Bootstrap is built on.

Quick revision table

Topic One line to remember
Grid 12 columns, container then row then col
Breakpoints sm 576, md 768, lg 992, xl 1200, xxl 1400
Mobile-first Classes apply from their breakpoint up
.container vs -fluid Fixed max width vs full width
Spacing m or p, side, size 0 to 5
Display d-none d-md-block
Flex d-flex justify-content-between align-items-center
Image img-fluid
Bootstrap 5 No jQuery, data-bs-*, ms and me

How to prepare in one week

Day Task
1 Add Bootstrap, containers and the grid
2 Breakpoints and a responsive card row
3 Spacing, display and flex utilities
4 Navbar and footer
5 Forms and validation classes
6 Modal, alerts and a small landing page
7 Revise and do a mock interview

Bootstrap sits on top of HTML and CSS, so revise the HTML interview questions and the CSS tutorial before the round.

Frequently Asked Questions

Is Bootstrap still worth learning?
Yes for freshers. It is used in many company admin panels, internal tools and older projects, and it teaches responsive layout ideas that carry over to any framework. Learn plain CSS, flexbox and grid alongside it so you understand what the classes do.
Should I learn Bootstrap or Tailwind CSS?
Check the job posts you are targeting. Bootstrap gives ready-made components and is quick for standard layouts. Tailwind gives small utility classes and is popular in newer React projects. Knowing CSS well makes either easy to pick up.
Which Bootstrap version should I prepare?
Prepare Bootstrap 5, the current major version. Know the main changes from Bootstrap 4: no jQuery, the new xxl breakpoint, and start and end instead of left and right in class names such as ms-3 and me-3.
Do Bootstrap interviews include practical tasks?
Often. You may be asked to build a responsive navbar, a row of cards that stacks on mobile, or a simple form. Practise writing these without copying from the documentation.
Can I use Bootstrap with React or Angular?
Yes. You can add the Bootstrap CSS directly and use its classes, or use wrapper libraries such as React-Bootstrap and ng-bootstrap that turn components into framework components.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 5 December 2026 LinkedIn
Chat with us