Skip to content

Instantly share code, notes, and snippets.

@markingman
Created February 12, 2015 16:16
Show Gist options
  • Save markingman/df8abc0aa3157ef3cef6 to your computer and use it in GitHub Desktop.
Save markingman/df8abc0aa3157ef3cef6 to your computer and use it in GitHub Desktop.
/*
Show CSS breakpoint labels for various screen widths
*/
body:after
{
content: 'default';
position: fixed;
bottom: 0;
left: 0;
padding: 0.2em;
font-family: monospace;
color: #fff;
background: red;
font-size: 10px;
z-index: 9999;
}
/*Breakpoint 1 ("tablet")*/
@media only screen and (max-width: 971px),
only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 971px),
only screen and ( min--moz-device-pixel-ratio: 2) and (max-width: 971px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (max-width: 971px),
only screen and ( min-device-pixel-ratio: 2) and (max-width: 971px),
only screen and ( min-resolution: 192dpi) and (max-width: 971px),
only screen and ( min-resolution: 2dppx) and (max-width: 971px)
{
body:after
{
content: 'tablet';
background: blue;
}
}
/*Breakpoint 2 ("mobile")*/
@media only screen and (max-width: 734px),
only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 734px),
only screen and ( min--moz-device-pixel-ratio: 2) and (max-width: 734px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (max-width: 734px),
only screen and ( min-device-pixel-ratio: 2) and (max-width: 734px),
only screen and ( min-resolution: 192dpi) and (max-width: 734px),
only screen and ( min-resolution: 2dppx) and (max-width: 734px)
{
body:after
{
content: 'mobile';
background: green;
}
}
/*Breakpoint 3 ("large")*/
@media only screen and (min-width: 1200px),
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 1200px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 1200px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 1200px),
only screen and ( min-device-pixel-ratio: 2) and (min-width: 1200px),
only screen and ( min-resolution: 192dpi) and (min-width: 1200px),
only screen and ( min-resolution: 2dppx) and (min-width: 1200px)
{
body:after
{
content: 'large';
background: orange;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment