1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/scss/mixins/_image.scss
Chris Rebert 763d77e210 Revert "Images are responsive by default"
This reverts commit d29f851e82.

Making <img>s responsive by-default without opt-in can severely break
third-party widgets such as Google Maps.
This was an acknowledged problem in Bootstrap v2
(see https://github.com/twbs/bootstrap/issues/1506 ) and was fixed in v3
by requiring the .img-responsive class for explicit opt-in
(see 09cdee2f03).
The situation hasn't really changed since then. The responsive-by-default
approach hasn't become any more suitable in the intervening time.

So let's avoid having this regress in v4. :-)
2015-03-28 04:06:22 -07:00

33 lines
946 B
SCSS

// Image Mixins
// - Responsive image
// - Retina image
// Responsive image
//
// Keep images from scaling beyond the width of their parents.
@mixin img-responsive($display: block) {
display: $display;
max-width: 100%; // Part 1: Set a maximum relative to the parent
height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching
}
// Retina image
//
// Short retina mixin for setting background-image and -size.
@mixin img-retina($file-1x, $file-2x, $width-1x, $height-1x) {
background-image: url("#{file-1x}");
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
background-image: url("#{file-2x}");
background-size: $width-1x $height-1x;
}
}