Skip to content

Instantly share code, notes, and snippets.

@vdboor
Created September 1, 2016 12:36
Show Gist options
  • Save vdboor/bc07114a864e68501456b441576243a0 to your computer and use it in GitHub Desktop.
Save vdboor/bc07114a864e68501456b441576243a0 to your computer and use it in GitHub Desktop.
Place a <div id="media-debug"></div> in the HTML, and this Sass code will show the active Bootstrap media query.
// Debugging for media queries
#media-debug {
position: fixed;
left: 0;
bottom: 20px;
color: #000;
font-weight: bold;
padding: 2px 5px;
z-index: 1001;
}
@media (min-width: $screen-xs-min) and (max-width: $screen-xs-max) {
#media-debug { background-color: #00f000; }
#media-debug::after { content: "Mobile (XS)"; }
}
@media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
#media-debug { background-color: #00d000; }
#media-debug::after { content: "Tablet (SM)"; }
}
@media (min-width: $screen-md-min) and (max-width: $screen-md-max) {
#media-debug { background-color: #00b100; }
#media-debug::after { content: "Desktop (MD)"; }
}
@media (min-width: $screen-lg-min) {
#media-debug { background-color: green; }
#media-debug::after { content: "Large (LG)"; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment