| 1 |
// stylelint-disable media-feature-name-no-vendor-prefix, media-feature-parentheses-space-inside, media-feature-name-no-unknown, indentation, at-rule-name-space-after |
| 2 |
|
| 3 |
// Responsive image |
| 4 |
// |
| 5 |
// Keep images from scaling beyond the width of their parents. |
| 6 |
.img-responsive(@display: block) { |
| 7 |
display: @display; |
| 8 |
max-width: 100%; // Part 1: Set a maximum relative to the parent |
| 9 |
height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching |
| 10 |
} |
| 11 |
|
| 12 |
|
| 13 |
// Retina image |
| 14 |
// |
| 15 |
// Short retina mixin for setting background-image and -size. Note that the |
| 16 |
// spelling of `min--moz-device-pixel-ratio` is intentional. |
| 17 |
.img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { |
| 18 |
background-image: url("@{file-1x}"); |
| 19 |
|
| 20 |
@media |
| 21 |
only screen and (-webkit-min-device-pixel-ratio: 2), |
| 22 |
only screen and ( min--moz-device-pixel-ratio: 2), |
| 23 |
only screen and ( -o-min-device-pixel-ratio: 2/1), |
| 24 |
only screen and ( min-device-pixel-ratio: 2), |
| 25 |
only screen and ( min-resolution: 192dpi), |
| 26 |
only screen and ( min-resolution: 2dppx) { |
| 27 |
background-image: url("@{file-2x}"); |
| 28 |
background-size: @width-1x @height-1x; |
| 29 |
} |
| 30 |
} |