You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.1 KiB

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