.block {
padding: 0 res-width(10px);
}
The above code, assuming $site-width
is set to 1280px, would return "0.78125%".
.block {
padding: 0 res-width(10px, 500px);
}
This would return "2%".
// calculate percentage widths from pixels based on site width (or other widths) | |
// Useage: `padding-left: res-width(10px);` | |
@function res-width($pixels, $container: $site-width) { | |
@return percentage($pixels / $container); | |
} |