Mastering Bootstrap Media Queries: Responsive Design Simplified

Ruth Jul 09, 2026

Bootstrap, the popular front-end framework, has revolutionized web development by providing a robust set of tools for creating responsive and mobile-first websites. One of its standout features is the integration of media queries, which allow developers to apply different styles based on the size and type of device being used. Let's delve into the world of Bootstrap media queries and explore how they can enhance your web design.

Bootstrap Media Queries and How to use it?
Bootstrap Media Queries and How to use it?

Before we dive into the specifics, it's crucial to understand that media queries are a CSS technique that enables content to be adapted to different screen sizes and devices. They use media queries to apply styles based on the characteristics of the user's device, such as screen resolution, aspect ratio, and color depth.

Bootstrap 5.3 (2025) Cheat Sheet
Bootstrap 5.3 (2025) Cheat Sheet

Understanding Bootstrap Media Queries

Bootstrap employs a mobile-first approach, which means that your website's styles are initially designed for mobile devices. As the screen size increases, media queries are used to apply additional styles and override the mobile styles. This ensures that your website looks great on all devices, from smartphones to desktops.

bootstrap cheatsheet
bootstrap cheatsheet

Bootstrap uses a specific set of media query breakpoints to target different screen sizes. These breakpoints are predefined and can be customized if needed. The default breakpoints are as follows:

  • xs - Extra small devices (portrait phones, less than 576px)
  • sm - Small devices (landscape phones, 576px and up)
  • md - Medium devices (tablets, 768px and up)
  • lg - Large devices (desktops, 992px and up)
  • xl - Extra large devices (large desktops, 1200px and up)
40+ Best Free Bootstrap Templates & Themes in 2026 — Speckyboy
40+ Best Free Bootstrap Templates & Themes in 2026 — Speckyboy

Using Bootstrap's Predefined Classes

Bootstrap provides predefined classes that correspond to these breakpoints. To apply styles based on a specific breakpoint, you can use these classes in your HTML. For example, to hide an element on small devices and show it on medium devices and above, you can use the following classes:

.d-none .d-sm-block

the words bootstrap 3 are written in white on a purple background with vertical stripes
the words bootstrap 3 are written in white on a purple background with vertical stripes

Customizing Bootstrap's Media Queries

While Bootstrap's predefined breakpoints cover a wide range of devices, you might need to customize them to fit your specific design requirements. You can do this by modifying the $grid-breakpoints variable in the Bootstrap source code. For instance, to change the medium breakpoint to 800px, you would update the variable like this:

$grid-breakpoints: (xs: 0, sm: 576px, md: 800px, lg: 992px, xl: 1200px);

a screenshot of a computer screen with the text,'how do i use this?
a screenshot of a computer screen with the text,'how do i use this?

Responsive Images with Bootstrap

Bootstrap also provides classes for creating responsive images. By adding the .img-fluid class to an image, it will scale up and down while maintaining its aspect ratio. This ensures that the image takes up the full width of its container on different screen sizes.

Bootstrap 5 Website Layout Design
Bootstrap 5 Website Layout Design
Bootstrap Media Query Breakpoints - ThePixelPixie
Bootstrap Media Query Breakpoints - ThePixelPixie
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
the color chart for different colors and font options in an iphone phone screen, including blue, red, yellow, green, black, white
the color chart for different colors and font options in an iphone phone screen, including blue, red, yellow, green, black, white
Bootstrap Photo Gallery
Bootstrap Photo Gallery
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial – Introduction
Bootstrap Tutorial – Introduction
Orlando Web Design: Bootstrap Responsive Layout | Bootstrap responsive grid | Bootstrap Media Queries | Bootstrap Supported devices | Bootstrap Flexible images
Orlando Web Design: Bootstrap Responsive Layout | Bootstrap responsive grid | Bootstrap Media Queries | Bootstrap Supported devices | Bootstrap Flexible images
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap 5 Classes List Cheat Sheet
Bootstrap 5 Classes List Cheat Sheet
the different types of font and numbers
the different types of font and numbers
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Themes at BootstrapZero
Bootstrap Themes at BootstrapZero
HOT GADGETS e-commerce web page
HOT GADGETS e-commerce web page
Unleashing Creativity at Nipro Agency
Unleashing Creativity at Nipro Agency

Additionally, you can use the .img-thumbnail class to add a rounded corner thumbnail border to an image. This class also makes the image responsive.

Responsive Image Sizes

Bootstrap also offers classes for setting the maximum width of an image based on the screen size. These classes are based on the predefined breakpoints and can be used in combination with the .img-fluid class. For example, to set the maximum width of an image to 50% on small devices and 100% on medium devices and above, you can use the following classes:

.img-fluid .w-50 .w-sm-100

In conclusion, Bootstrap media queries are a powerful tool for creating responsive and mobile-first websites. By leveraging the predefined classes and customizing the breakpoints as needed, you can ensure that your website looks and functions beautifully on all devices. So go ahead, embrace the power of Bootstrap media queries, and create stunning, responsive websites that captivate your audience.