bootstrap/less/responsive-utilities.less
Mark Otto a2b9988eb9 Media query (grid and responsive utilities) overhaul
Grid classes have been changed to account for a fourth set of classes,
meaning we now have XS, S, M, and L options. Specifically, we made the
following changes:

* Renames `.col-` to `.col-xs-`
* Adds `.col-md-` for devices 992px wide and up
* Remaps `.col-lg-` for devices 1200px wide and up

Alongside that, we've updated our media queries to better handle
advanced grid layouts:

* All column classes now kick in when they hit a `min-width`, undoing
the #9128 fix in
https://github.com/twbs/bootstrap/commit/db45a60cc86190a060f0baf0b3961cb
c690f3a65
* All column offsets, pushes, and pulls are scoped to an appropriate
range, meaning a `min-width` and `max-width` (thanks for the idea,
@eratzlaff)

We've also modified the widths of our grid containers for the small
device grid (now a max 720px instead of 728px) and large device grid
(now a max 1140px instead of 1170px) to avoid horizontal scrollbar
problems in Firefox (likely due to box-sizing, which is why we didn't
see it in 2.x).

Similarly, we've updated the responsive ultility classes to match the
new four media query approach of the grid system. That means we've:

* Added new `.visible-xs` and `.hidden-xs` classes
* Reassigns visible and hidden classes for small, medium, and large to
matching grid system media queries
* Updates docs examples to match grid system and account for fourth
utility range

-----

Fixes the following:

* #9135: fourth grid tier
* #9302: undoes previous range change for small grid system, so no need
to update any docs here
* #8755: consistent grid and responsive utilities schemas)
* #9195, #9216, and #9227: no more horizontal scrollbars
2013-08-12 00:28:50 -07:00

150 lines
3.9 KiB
Plaintext

//
// Responsive: Utility classes
// --------------------------------------------------
// IE10 Metro responsive
// Required for Windows 8 Metro split-screen snapping with IE10
//
// Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/
@-ms-viewport{
width: device-width;
}
// IE10 on Windows Phone 8
// IE10 on WP8 doesn't report CSS pixels, but actual device pixels. In
// other words, say on a Lumia, you'll get 768px as the device width,
// meaning users will see the tablet styles and not phone styles.
//
// Alternatively you can override this with JS (see source below), but
// we won't be doing that here given our limited scope.
//
// Source: http://timkadlec.com/2013/01/windows-phone-8-and-device-width/
@media screen and (max-width: 400px) {
@-ms-viewport{
width: 320px;
}
}
// Hide from screenreaders and browsers
// Credit: HTML5 Boilerplate
.hidden {
display: none !important;
visibility: hidden !important;
}
// Visibility utilities
.visible-xs {
.responsive-visibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
.visible-sm {
.responsive-invisibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
.visible-md {
.responsive-invisibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
.visible-lg {
.responsive-invisibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
}
.hidden-xs {
.responsive-invisibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
}
.hidden-sm {
.responsive-visibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-invisibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
}
.hidden-md {
.responsive-visibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-invisibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-visibility();
}
}
.hidden-lg {
.responsive-visibility();
@media (min-width: @screen-tablet) and (max-width: @screen-tablet-max) {
.responsive-visibility();
}
@media (min-width: @screen-desktop) and (max-width: @screen-desktop-max) {
.responsive-visibility();
}
@media (min-width: @screen-large-desktop) {
.responsive-invisibility();
}
}
// Print utilities
.visible-print {
.responsive-invisibility();
}
.hidden-print { }
@media print {
.visible-print {
.responsive-visibility();
}
.hidden-print {
.responsive-invisibility();
}
}