Skip to content

Instantly share code, notes, and snippets.

@AlexandrBukhtatyy
Last active December 28, 2016 12:55
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 AlexandrBukhtatyy/5edace02dc290eb4d3694b6e69f4a37d to your computer and use it in GitHub Desktop.
Save AlexandrBukhtatyy/5edace02dc290eb4d3694b6e69f4a37d to your computer and use it in GitHub Desktop.
Адаптация только CSS-правила
.class1 {
padding: #333;
}
@media (min-width: 320px) {
.class1 {
padding: 10px;
}
}
@media (min-width: 480px) {
.class1 {
padding: 15px;
}
}
@media (min-width: 640px) {
.class1 {
padding: 15px;
}
}
@media (min-width: 768px) {
.class1 {
padding: 20px;
}
}
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@mixin responsive($properties,$defaultValue, $responsiveValues){
&{
@each $property in $properties{
#{$property}:$defaultValue;
}
}
@each $media, $value in $responsiveValues{
@media #{$media}{
&{
@each $property in $properties{
#{$property}:$value;
}
}
}
}
}
$w0:"(min-width:0px)";
$w320:"(min-width:320px)";
$w480:"(min-width:480px)";
$w640:"(min-width:640px)";
$w768:"(min-width:768px)";
.class1{
@include responsive("padding",#333,($w320:10px, $w480:15px, $w640:15px, $w768:20px, ));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment