Skip to content

Instantly share code, notes, and snippets.

@rjfranco
Created May 7, 2014 19:20
Show Gist options
  • Select an option

  • Save rjfranco/9b2e9deebd0be922f828 to your computer and use it in GitHub Desktop.

Select an option

Save rjfranco/9b2e9deebd0be922f828 to your computer and use it in GitHub Desktop.
Object Oriented Media Queries with Sass
@mixin respond-to($media) {
@if $media == small {
@media only screen and (max-width: 1024px) {
@content;
}
}
@if $media == tablet {
// @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
// @content;
// }
@media only screen and (min-width: 768px) and (max-width: 959px) {
@content;
}
}
@else if $media == mobile {
@media only screen and (max-width: 767px) {
@content;
}
}
}
import 'mixin';
img.image-type {
position: absolute;
width: 24px;
height: 24px;
right: 15px;
top: 15px;
@include respond-to(mobile) {
top: 10px;
right: 10px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment