web
mobile
Edit these docs Rate these docs

Media queries

Bootstrap media queries

Since Bootstrap is developed to be mobile first, we use a handful of media queries to create sensible breakpoints for our layouts and interfaces. These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes.

Bootstrap primarily uses the following media query ranges — or breakpoints — in our source Sass files for our layout, grid system, and components.


Media queries as responsive breakpoints



          // Extra small devices (portrait phones, less than 576px)
          // No media query since this is the default in Bootstrap

          // Small devices (landscape phones, 576px and up)
          @media (min-width: 576px) { ... }

          // Medium devices (tablets, 768px and up)
          @media (min-width: 768px) { ... }

          // Large devices (desktops, 992px and up)
          @media (min-width: 992px) { ... }

          // Extra large devices (large desktops, 1200px and up)
          @media (min-width: 1200px) { ... }

Media queries available via Sass mixins

Since we write our source CSS in Sass, all our media queries are available via Sass mixins:



          @include media-breakpoint-up(xs) { ... }
          @include media-breakpoint-up(sm) { ... }
          @include media-breakpoint-up(md) { ... }
          @include media-breakpoint-up(lg) { ... }
          @include media-breakpoint-up(xl) { ... }

          // Example usage:
          @include media-breakpoint-up(sm) {
            .some-class {
              display: block;
            }
          }

      

The other direction of responsive breakpoint queries

We occasionally use media queries that go in the other direction (the given screen size or smaller):



          // Extra small devices (portrait phones, less than 576px)
          @media (max-width: 575px) { ... }

          // Small devices (landscape phones, less than 768px)
          @media (max-width: 767px) { ... }

          // Medium devices (tablets, less than 992px)
          @media (max-width: 991px) { ... }

          // Large devices (desktops, less than 1200px)
          @media (max-width: 1199px) { ... }

          // Extra large devices (large desktops)
          // No media query since the extra-large breakpoint has no upper bound on its width

Media queries Sass mixins example

Once again, these media queries are also available via Sass mixins:



          @include media-breakpoint-down(xs) { ... }
          @include media-breakpoint-down(sm) { ... }
          @include media-breakpoint-down(md) { ... }
          @include media-breakpoint-down(lg) { ... }

      

Minimal and maximum media queries

There are also media queries and mixins for targeting a single segment of screen sizes using the minimum and maximum breakpoint widths.



          // Extra small devices (portrait phones, less than 576px)
          @media (max-width: 575px) { ... }

          // Small devices (landscape phones, 576px and up)
          @media (min-width: 576px) and (max-width: 767px) { ... }

          // Medium devices (tablets, 768px and up)
          @media (min-width: 768px) and (max-width: 991px) { ... }

          // Large devices (desktops, 992px and up)
          @media (min-width: 992px) and (max-width: 1199px) { ... }

          // Extra large devices (large desktops, 1200px and up)
          @media (min-width: 1200px) { ... }

      

Minimal - maximum media queries Sass mixins

These media queries are also available via Sass mixins:



          @include media-breakpoint-only(xs) { ... }
          @include media-breakpoint-only(sm) { ... }
          @include media-breakpoint-only(md) { ... }
          @include media-breakpoint-only(lg) { ... }
          @include media-breakpoint-only(xl) { ...
      

Media queries multiple breakpoints widths

Similarly, media queries may span multiple breakpoint widths:



          // Example
          // Apply styles starting from medium devices and up to extra large devices
          @media (min-width: 768px) and (max-width: 1199px) { ... }

      

The Sass mixin for targeting the same screen size range would be:



        @include media-breakpoint-between(md, xl) { ...
      

Usage of media queries within panels

Resize the screen to see the effect of media queries.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.



        <!-- Grid row -->
        <div class="row">

          <!-- Grid column -->
          <div class="column mb-4 px-2">

            <!--Card Primary-->
            <div class="card indigo text-center z-depth-2">
              <div class="card-body">
                <p class="white-text mb-0">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti
                  atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique
                  sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.</p>
              </div>
            </div>
            <!--/.Card Primary-->

          </div>
          <!-- Grid column -->

          <!-- Grid column -->
          <div class="column mb-4 px-2">

            <!--Card Primary-->
            <div class="card danger-color text-center z-depth-2">
              <div class="card-body">
                <p class="white-text mb-0">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti
                  atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique
                  sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.</p>
              </div>
            </div>
            <!--/.Card Primary-->

          </div>
          <!-- Grid column -->

          <!-- Grid column -->
          <div class="column mb-4 px-2">

            <!--Card Primary-->
            <div class="card info-color text-center z-depth-2">
              <div class="card-body">
                <p class="white-text mb-0">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti
                  atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique
                  sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.</p>
              </div>
            </div>
            <!--/.Card Primary-->

          </div>
          <!-- Grid column -->

          <!-- Grid column -->
          <div class="column mb-4 px-2">

            <!--Card Primary-->
            <div class="card mdb-color text-center z-depth-2">
              <div class="card-body">
                <p class="white-text mb-0">At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti
                  atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique
                  sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.</p>
              </div>
            </div>
            <!--/.Card Primary-->

          </div>
          <!-- Grid column -->

        </div>
        <!-- Grid row -->

      


          @media (max-width: 767px) {
            .column {
                width: 100%;
            }
        }
        @media (min-width: 768px) and (max-width: 1024px) {
            .column {
                width: 50%;
            }
        }
        @media (min-width: 1025px) {
            .column {
                width: 25%;
            }
        }
      

Usage of media queries within cards

Resize the screen to see the effect of media queries.

Title of the news

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas.

Button

Title of the news

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas.

Button

Title of the news

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas.

Button


        <!-- Grid row -->
        <div class="row">

          <!-- Grid column -->
          <div class="column-2 px-2 mb-r">

            <!--Card-->
            <div class="card default-color-dark">

              <!--Card image-->
              <div class="view">
                <img src="https://mdbootstrap.com/img/Photos/Slides/img%2810%29.jpg" class="card-img-top" alt="photo">
                <a href="#">
                  <div class="mask rgba-white-slight"></div>
                </a>
              </div>

              <!--Card content-->
              <div class="card-body text-center">
                <!--Title-->
                <h4 class="card-title white-text">Title of the news</h4>
                <!--Text-->
                <p class="card-text white-text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem
                  aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
                  Nemo enim ipsam voluptatem quia voluptas.</p>
                <a href="#" class="btn btn-outline-white btn-md">Button</a>
              </div>

            </div>
            <!--/.Card-->

          </div>
          <!-- Grid column -->

          <!-- Grid column -->
          <div class="column-1 px-2 mb-r">

            <!--Card-->
            <div class="card primary-color-dark">

              <!--Card image-->
              <div class="view">
                <img src="https://mdbootstrap.com/img/Photos/Slides/img%2811%29.jpg" class="card-img-top" alt="photo">
                <a href="#">
                  <div class="mask rgba-white-slight"></div>
                </a>
              </div>

              <!--Card content-->
              <div class="card-body text-center">
                <!--Title-->
                <h4 class="card-title white-text">Title of the news</h4>
                <!--Text-->
                <p class="card-text white-text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem
                  aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
                  Nemo enim ipsam voluptatem quia voluptas.</p>
                <a href="#" class="btn btn-outline-white btn-md">Button</a>
              </div>

            </div>
            <!--/.Card-->

          </div>
          <!-- Grid column -->

          <!-- Grid column -->
          <div class="column-1 px-2">

            <!--Card-->
            <div class="card warning-color-dark">

              <!--Card image-->
              <div class="view">
                <img src="https://mdbootstrap.com/img/Photos/Slides/img%2812%29.jpg" class="card-img-top" alt="photo">
                <a href="#">
                  <div class="mask rgba-white-slight"></div>
                </a>
              </div>

              <!--Card content-->
              <div class="card-body text-center">
                <!--Title-->
                <h4 class="card-title white-text">Title of the news</h4>
                <!--Text-->
                <p class="card-text white-text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem
                  aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
                  Nemo enim ipsam voluptatem quia voluptas.</p>
                <a href="#" class="btn btn-outline-white btn-md">Button</a>
              </div>

            </div>
            <!--/.Card-->

          </div>
          <!-- Grid column -->

        </div>
        <!-- Grid row -->

      


          @media (max-width: 767px) {
            .column-1,
            .column-2 {
                width: 100%;
            }
        }
        @media (min-width: 768px) and (max-width: 991px) {
            .column-1 {
                width: 50%;
            }
            .column-2 {
                width: 100%;
            }
        }
        @media (min-width: 992px) {
            .column-2,
            .column-1 {
                width: 33%;
            }
        }
      
Edit these docs Rate these docs

Getting started: download & setup


Download

All of the components and features are a part of the MDBootstrap package.

MDBootstrap (Material Design for Bootstrap) is an MIT Licensed framework - free for personal & commercial use.

It combines the esthetic of Material Design and the functionalities of the newest Bootstrap.

Click on the button below to visit the Getting Started Page, where you can download the latest MDBootstrap package.

MDBootstrap Download MDBootstrap About

MDB Pro

Using components and features labeled as MDB Pro component requires the MDB Pro package - a powerful UI Kit containing over 5,000 components, dozens of plugins and much more cool features.

Click the button below to learn more about the MDBootstrap Pro package.

MDBootstrap Pro

Tutorials

If you need any additional help, use our "5 min Quick Start" guide or start full Bootstrap tutorial.

5 min Quick Start Full Bootstrap Tutorial

Compilation & Customization

To reduce the weight of MDBootstrap package even more, you can compile your own, custom package containing only those components and features that you need.

If you need additional help with compiling your custom package, please use our Compilation & Customization tutorial.

Compilation & Customization tutorial

Map of dependencies of SCSS files in MDBootstrap:


    Legend:

    '-->' means 'required'

    All free and pro files require files from 'core' catalog

    'none' means 'this component doesn't require anything except core files'

    A file wrapped by `< >` means that this file make the base component prettier but it isn't necessary for the proper working

    All PRO components require 'pro/_variables.scss' file

    scss/
    |
    |-- core/
    |   |
    |   |-- bootstrap/
    |   |	|-- _functions.scss
    |   |	|-- _variables.scss
    |   |
    |   |-- _colors.scss
    |   |-- _global.scss
    |   |-- _helpers.scss
    |   |-- _masks.scss
    |   |-- _mixins.scss
    |   |-- _typography.scss
    |   |-- _variables.scss
    |   |-- _waves.scss
    |
    |-- free/
    |   |-- _animations-basic.scss --> none
    |   |-- _animations-extended.scss --> _animations-basic.scss
    |   |-- _buttons.scss --> none
    |   |-- _cards.scss --> none <_buttons.scss>
    |   |-- _dropdowns.scss --> none <_buttons.scss>
    |   |-- _input-group.scss --> _forms.scss, _buttons.scss, _dropdowns.scss
    |   |-- _navbars.scss --> none <_buttons.scss, _forms.scss, _input-group.scss>
    |   |-- _pagination.scss --> none
    |   |-- _badges.scss --> none
    |   |-- _modals.scss --> _buttons.scss, _forms.scss (PRO --> _tabs.scss)
    |   |-- _carousels.scss --> <_buttons.scss>
    |   |-- _forms.scss --> none
    |   |-- _msc.scss --> none <_buttons.scss, _forms.scss, _cards.scss>
    |   |-- _footers.scss none <_buttons.scss> (PRO: )
    |   |-- _list-group.scss --> none
    |   |-- _tables.scss --> none (PRO: _material-select.scss, pro/_forms.scss, _checkbox.scss, pro/_buttons.scss, pro/_cards.scss, _pagination.scss, pro/_msc.scss)
    |   |-- _depreciated.scss
    |
    |-- pro/
    |   |
    |   |-- picker/
    |   |   |-- _default.scss --> none
    |   |   |-- _default-time.scss --> _default.scss, free/_forms.scss, free/_buttons.scss, pro/_buttons.scss, free/_cards.scss
    |   |   |-- _default-date.scss --> _default.scss, free/_forms.scss
    |   |
    |   |-- sections/
    |   |   |-- _templates.scss --> _sidenav.scss
    |   |   |-- _social.scss --> free/_cards.scss, free/ _forms.scss, free/_buttons.scss, pro/_buttons.scss,
    |   |   |-- _team.scss --> free/_buttons.scss, pro/_buttons.scss, free/_cards.scss, pro/_cards.scss
    |   |   |-- _testimonials.scss --> free/_carousels.scss, pro/_carousels.scss, free/_buttons.scss, pro/_buttons.scss
    |   |   |-- _magazine.scss --> _badges.scss
    |   |   |-- _pricing.scss --> free/_buttons.scss, pro/_buttons.scss
    |   |   |-- _contacts.scss --> free/_forms.scss, pro/_forms.scss, free/_buttons.scss, pro/_buttons.scss
    |   |
    |   |-- _variables.scss
    |   |-- _buttons.scss --> free/_buttons.scss, pro/_msc.scss, _checkbox.scss, _radio.scss
    |   |-- _social-buttons.scss --> free/_buttons.scss, pro/_buttons.scss
    |   |-- _tabs.scss --> _cards.scss
    |   |-- _cards.scss --> free/_cards.scss <_buttons.scss, _social-buttons.scss>
    |   |-- _dropdowns.scss --> free/_dropdowns.scss, free/_buttons.scss
    |   |-- _navbars.scss --> free/_navbars.scss  (PRO: )
    |   |-- _scrollspy.scss --> none
    |   |-- _lightbox.scss --> none
    |   |-- _chips.scss --> none
    |   |-- _msc.scss --> none
    |   |-- _forms.scss --> none
    |   |-- _radio.scss --> none
    |   |-- _checkbox.scss --> none
    |   |-- _material-select.scss --> none
    |   |-- _switch.scss --> none
    |   |-- _file-input.scss --> free/_forms.scss, free/_buttons.scss
    |   |-- _range.scss --> none
    |   |-- _input-group.scss --> free/_input-group.scss and the same what free input group, _checkbox.scss, _radio.scss
    |   |-- _autocomplete.scss --> free/_forms.scss
    |   |-- _accordion.scss --> pro/_animations.scss, free/_cards.scss
    |   |-- _parallax.scss --> none
    |   |-- _sidenav.scss --> free/_forms.scss, pro/_animations.scss, sections/_templates.scss
    |   |-- _ecommerce.scss --> free/_cards.scss, pro/_cards.scss, free/_buttons.scss, pro/_buttons.scss, pro/_msc.scss
    |   |-- _carousels.scss --> free/_carousels.scss, free/_cards.scss, free/_buttons.scss 
    |   |-- _steppers.scss --> free/_buttons.scss
    |   |-- _blog.scss --> none
    |   |-- _toasts.scss --> free/_buttons.scss
    |   |-- _animations.scss --> none
    |   |-- _charts.scss --> none
    |   |-- _progress.scss --> none
    |   |-- _scrollbar.scss --> none
    |   |-- _skins.scss --> none
    |   |-- _depreciated.scss
    |
    `-- _custom-skin.scss
    `-- _custom-styles.scss
    `-- _custom-variables.scss
    `-- mdb.scss

  

Map of dependencies of JavaScript modules in MDBootstrap:


    Legend:

    '-->' means 'required'

    All files require jQuery and bootstrap.js

    js/
    ├── dist/
    │   ├── buttons.js
    │   ├── cards.js
    │   ├── character-counter.js
    │   ├── chips.js
    │   ├── collapsible.js --> vendor/velocity.js
    │   ├── dropdown.js --> Popper.js, jquery.easing.js
    │   ├── file-input.js
    │   ├── forms-free.js
    │   ├── material-select.js --> dropdown.js
    │   ├── mdb-autocomplete.js
    │   ├── preloading.js
    │   ├── range-input.js --> vendor/velocity.js
    │   ├── scrolling-navbar.js
    │   ├── sidenav.js --> vendor/velocity.js, vendor/hammer.js, vendor/jquery.hammer.js
    │   └── smooth-scroll.js
    ├── _intro-mdb-pro.js
    ├── modules.js
    ├── src/
    │   ├── buttons.js
    │   ├── cards.js
    │   ├── character-counter.js
    │   ├── chips.js
    │   ├── collapsible.js --> vendor/velocity.js
    │   ├── dropdown.js --> Popper.js, jquery.easing.js
    │   ├── file-input.js
    │   ├── forms-free.js
    │   ├── material-select.js --> dropdown.js
    │   ├── mdb-autocomplete.js
    │   ├── preloading.js
    │   ├── range-input.js --> vendor/velocity.js
    │   ├── scrolling-navbar.js
    │   ├── sidenav.js --> vendor/velocity.js, vendor/hammer.js, vendor/jquery.hammer.js
    │   └── smooth-scroll.js
    └── vendor/
        ├── addons/
        │   ├── datatables.js
        │   └── datatables.min.js
        ├── chart.js
        ├── enhanced-modals.js
        ├── hammer.js
        ├── jarallax.js
        ├── jarallax-video.js --> vendor/jarallax.js
        ├── jquery.easing.js
        ├── jquery.easypiechart.js
        ├── jquery.hammer.js --> vendor/hammer.js
        ├── jquery.sticky.js
        ├── lightbox.js
        ├── picker-date.js --> vendor/picker.js
        ├── picker.js
        ├── picker-time.js --> vendor/picker.js
        ├── scrollbar.js
        ├── scrolling-navbar.js
        ├── toastr.js
        ├── velocity.js
        ├── waves.js
        └── wow.js
  

Integrations with Angular, React or Vue

Apart from the standard Bootstrap integration (using jQuery), MDBootstrap also integrates with Angular, React and Vue.

About MDB Angular About MDB React About MDB Vue

Exclusive resources

MDBootstrap is a platform for web creators and MDB packages are only a part of it.

If you sign up you'll gain free access to other useful tools & resources including:

  • Community developed components & design projects
  • Technical support & community forum
  • CLI interface & free project hosting
  • Helpful articles & news agregators

...and much more!

Don't hesitate and sign up now!

Sign up now