Skip to content

Instantly share code, notes, and snippets.

@alexwoollam
Last active September 19, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexwoollam/687b32757e0fb6fa30ea99741e4b663c to your computer and use it in GitHub Desktop.
Save alexwoollam/687b32757e0fb6fa30ea99741e4b663c to your computer and use it in GitHub Desktop.
Bootstrap responsive helper/
body{
// Dev tool, remove once done! //
@include media('xs') {
&::before{
content: "xs";
position: fixed;
top: 0px;
height: 20px;
width: 100%;
background-color: #D9B504;
color: $white;
z-index: 999999999999;
opacity: 0.5;
text-align: center;
font-weight: bold;
}
}
@include media('sm') {
&::before{
content: "sm";
position: fixed;
top: 0px;
height: 20px;
width: 100%;
background-color: #F29F05;
color: $white;
z-index: 999999999999;
opacity: 0.5;
text-align: center;
font-weight: bold;
}
}
@include media('md') {
&::before{
content: "md";
position: fixed;
top: 0px;
height: 20px;
width: 100%;
background-color: #D97904;
color: $white;
z-index: 999999999999;
opacity: 0.5;
text-align: center;
font-weight: bold;
}
}
@include media('lg') {
&::before{
content: "lg";
position: fixed;
top: 0px;
height: 20px;
width: 100%;
background-color: #BF0404;
color: $white;
z-index: 999999999999;
opacity: 0.5;
text-align: center;
font-weight: bold;
}
}
@include media('xl') {
&::before{
content: "xl";
position: fixed;
top: 0px;
height: 20px;
width: 100%;
background-color: #730202;
color: $white;
z-index: 999999999999;
opacity: 0.5;
text-align: center;
font-weight: bold;
}
}
}
// Additional mixin for getting the sizes. //
$breakpoint: (
xs: 575px,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px
);
@mixin media($break) {
$value: map-get($breakpoint, $break);
$xs: map-get($breakpoint, 'xs');
@if $value == $xs {
@media (max-width: $value) {
@content;
}
}
@else {
@media (min-width: $value) {
@content;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment