Bootstrap 3 Breakpoints Code Example


Example 1: bootstrap media query breakpoints

// Extra small devices (portrait phones, less than 576px) @media (max-width: 575.98px) { ... }  // Small devices (landscape phones, 576px and up) @media (min-width: 576px) and (max-width: 767.98px) { ... }  // Medium devices (tablets, 768px and up) @media (min-width: 768px) and (max-width: 991.98px) { ... }  // Large devices (desktops, 992px and up) @media (min-width: 992px) and (max-width: 1199.98px) { ... }  // Extra large devices (large desktops, 1200px and up) @media (min-width: 1200px) { ... }

Example 2: bootstrap media queries

/* Answer to: "bootstrap media queries" */  /*   Since Bootstrap is developed to be mobile first, the use a handful   of media queries to create sensible breakpoints for their layouts   and interfaces. These breakpoints are mostly based on minimum   viewport widths and allow scaling up elements as the viewport   changes.    Bootstrap primarily uses the following media query ranges—or   breakpoints—in their source Sass files for their layout, grid system,   and components. */  /* Extra small devices (portrait phones, less than 576px) */ /* No media query for `xs` since this is the default in Bootstrap */`32`  /* 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) { ... }

Example 3: bootstrap Responsive

Responsive containers are new in Bootstrap v4.4. They allow you to specify a class that is 100% wide until the specified breakpoint is reached, after which we apply max-widths for each of the higher breakpoints. For example, .container-sm is 100% wide to start until the sm breakpoint is reached, where it will scale up with md, lg, and xl.  Copy <div class="container-sm">100% wide until small breakpoint</div> <div class="container-md">100% wide until medium breakpoint</div> <div class="container-lg">100% wide until large breakpoint</div> <div class="container-xl">100% wide until extra large breakpoint</div>   // Extra small devices (portrait phones, less than 576px) // No media query for `xs` 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) { ... }   Since we write our source CSS in Sass, all our media queries are available via Sass mixins:  // No media query necessary for xs breakpoint as it's effectively `@media (min-width: 0) { ... }` @include media-breakpoint-up(sm) { ... } @include media-breakpoint-up(md) { ... } @include media-breakpoint-up(lg) { ... } @include media-breakpoint-up(xl) { ... }  // Example: Hide starting at `min-width: 0`, and then show at the `sm` breakpoint .custom-class {   display: none; } @include media-breakpoint-up(sm) {   .custom-class {     display: block;   } } 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: 575.98px) { ... }  // Small devices (landscape phones, less than 768px) @media (max-width: 767.98px) { ... }  // Medium devices (tablets, less than 992px) @media (max-width: 991.98px) { ... }  // Large devices (desktops, less than 1200px) @media (max-width: 1199.98px) { ... }  // Extra large devices (large desktops) // No media query since the extra-large breakpoint has no upper bound on its width   Once again, these media queries are also available via Sass mixins:  Copy @include media-breakpoint-down(xs) { ... } @include media-breakpoint-down(sm) { ... } @include media-breakpoint-down(md) { ... } @include media-breakpoint-down(lg) { ... } // No media query necessary for xl breakpoint as it has no upper bound on its width  // Example: Style from medium breakpoint and down @include media-breakpoint-down(md) {   .custom-class {     display: block;   } }  $zindex-dropdown:          1000 !default; $zindex-sticky:            1020 !default; $zindex-fixed:             1030 !default; $zindex-modal-backdrop:    1040 !default; $zindex-modal:             1050 !default; $zindex-popover:           1060 !default; $zindex-tooltip:           1070 !default;

Example 4: bootstrap container width

-------------------------------------------------------------------------------------- Bootstrap Container Width			 					| Size        | Class Prefix -------------------------------------------------------------------------------------- Extra small devices Phones (less than 768px)  			| None (auto) | .col-xs- Small devices Tablets (greater than equals 768px) 		| 750px       | .col-sm- Medium devices Desktops (greater than equals 992px)     | 970px       | .col-md- Large devices Desktops (greater than equals 1200px)     | 1170px      | .col-lg-

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?