From 18550e0d1fcd1efc559700291d5b2c2956704d96 Mon Sep 17 00:00:00 2001 From: nx Date: Tue, 15 Feb 2022 18:54:13 +0000 Subject: [PATCH] add img-fluid helper Responsive images (ensure images don't scale beyond their parents) --- src/scss/helpers/_image.scss | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/scss/helpers/_image.scss diff --git a/src/scss/helpers/_image.scss b/src/scss/helpers/_image.scss new file mode 100644 index 0000000..b838216 --- /dev/null +++ b/src/scss/helpers/_image.scss @@ -0,0 +1,13 @@ +// Image Mixins + +// Responsive image +// +// Keep images from scaling beyond the width of their parents. +// Solution provided by Twitter Bootstrap https://github.com/twbs/bootstrap/commit/88bf5af896a872d65752956e85adb66a9192e697#diff-74a54d296e5e8ef9f54d15fe3330778f63536c312545c97c169b4fd213fe93a5 +@mixin img-fluid { + // Part 1: Set a maximum relative to the parent + max-width: 100%; + // Part 2: Override the height to auto, otherwise images will be stretched + // when setting a width and height attribute on the img element. + height: auto; +}