git repos / blockattack-game

blame: source/misc/embedded_libs/fmt-8.1.1/doc/bootstrap/mixins/image.less

normal view · raw

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