]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Revert "Images are responsive by default"
authorChris Rebert <code@rebertia.com>
Sat, 28 Mar 2015 11:06:22 +0000 (04:06 -0700)
committerChris Rebert <code@rebertia.com>
Sat, 28 Mar 2015 11:06:22 +0000 (04:06 -0700)
This reverts commit d29f851e827db27fb42573f14003bb018c037342.

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 09cdee2f03aaad5c5a767fbec2e3896ad3d1f980).
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. :-)

scss/_carousel.scss
scss/_scaffolding.scss
scss/mixins/_image.scss

index 7c045a1e9b031f5c7eeadcd4d3b2b24388c24272..90aee7ad959d0d604bfa4aea8489feab14340484 100644 (file)
@@ -21,7 +21,7 @@
     // Account for jankitude on images
     > img,
     > a > img {
-      // @extend .img-responsive;
+      @extend .img-responsive;
       line-height: 1;
     }
 
index 27e09e96f6087e3d0a3ef6ddc76f05e740e7feaf..a6abc862d114e568939ce4247b7456bcb3d1b98e 100644 (file)
@@ -86,13 +86,14 @@ a {
 // Images
 
 img {
-  // Make them responsive with `max-width` and `height`
-  max-width: 100%;
-  height: auto;
-  // Match vertical alignment of most other Bootstrapped elements
   vertical-align: middle;
 }
 
+// Responsive images (ensure images don't scale beyond their parents)
+.img-responsive {
+  @include img-responsive();
+}
+
 // Rounded corners
 .img-rounded {
   @include border-radius($border-radius-lg);
@@ -109,7 +110,7 @@ img {
   @include box-shadow(0 1px 2px rgba(0,0,0,.075));
 
   // Keep them at most 100% wide
-  // @include img-responsive(inline-block);
+  @include img-responsive(inline-block);
 }
 
 // Perfect circle
index 9ff91370daa964f9959965db49ff886ee77b6149..bec9626f60c93c982a1d7c70b7b43b191777a76a 100644 (file)
@@ -1,3 +1,19 @@
+// 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.