mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
763d77e210
This reverts commitd29f851e82
. 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 (see09cdee2f03
). 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. :-)
34 lines
946 B
SCSS
34 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;
|
|
}
|
|
}
|