Rate this 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;
            }
          }

      

Other direction of responsive breakpoints

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%;
            }
        }
      

Getting started : download & setup


Download

All the components and features are part of MDBootstrap package.

MDBootstrap (Material Design for Bootstrap) is a free (MIT Licensed) framework combining Material Design and the newest Bootstrap 4.

Click the button below to go to Download Page, where you can download MDBootstrap package.

MDBootstrap Download MDBootstrap About

MDB Pro

Using components and features labeled as MDB Pro component requires MDB Pro package.

Click the button below to learn more about MDBbootstrap Pro package

MDBootstrap Pro

Tutorials

If you need additional help to start, use our "5 min Quick Start" or "Full tutorial" resources.

5 min Quick Start Full Tutorial

Compilation

To reduce a weight of MDBootstrap package, you can compile your own, custom package containing only components and features you need.

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
  

Compilation & Customization tutorial

If you need additional help to compile your custom package, use our Compilation & Customization tutorial

Compilation & Customization tutorial

Integrations with Angular, React or Vue

Apart from standard Bootstrap integration with jQuery, MDBootstrap provides integrations with Angular, React and Vue.

About MDB Angular About MDB React About MDB Vue