bdc31789873af2442bafeb267325ec79ac628c6e.svn-base 946 B

123456789101112131415161718192021222324252627282930313233
  1. // Image Mixins
  2. // - Responsive image
  3. // - Retina image
  4. // Responsive image
  5. //
  6. // Keep images from scaling beyond the width of their parents.
  7. @mixin img-responsive($display: block) {
  8. display: $display;
  9. max-width: 100%; // Part 1: Set a maximum relative to the parent
  10. height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
  11. }
  12. // Retina image
  13. //
  14. // Short retina mixin for setting background-image and -size.
  15. @mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) {
  16. background-image: url("#{file-1x}");
  17. @media
  18. only screen and (-webkit-min-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. }