From 0d34169e1f1126c0e752694905c037278402e0c8 Mon Sep 17 00:00:00 2001 From: Bass Jobsen Date: Mon, 2 Nov 2015 20:56:24 +0100 Subject: [PATCH] Refactor figure image styles to use CSS class instead of child selector Refactoring according the comments on https://github.com/twbs/bootstrap/pull/18104. Closes #18131 --- docs/content/figures.md | 6 +++--- scss/_images.scss | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/content/figures.md b/docs/content/figures.md index d8e2435feb..7b3df8bd10 100644 --- a/docs/content/figures.md +++ b/docs/content/figures.md @@ -6,11 +6,11 @@ group: content Anytime you need to display a piece of content—like an image—with an optional caption, consider using a `
`. -Use the included `.figure` and `.figure-caption` classes to provide some baseline styles for the HTML5 `
` and `
` elements. As a bonus, immediate children images are automatically responsive. +Use the included `.figure` , `.figure-img` and `.figure-caption` classes to provide some baseline styles for the HTML5 `
` and `
` elements. Images in figures have no explicit size, so be sure to add the `.img-fluid` class to your `` to make it responsive. {% example html %}
- A generic square placeholder image with rounded corners in a figure. + A generic square placeholder image with rounded corners in a figure.
A caption for the above image.
{% endexample %} @@ -19,7 +19,7 @@ Aligning the figure's caption is easy with our [text utilities]({{ site.baseurl {% example html %}
- A generic square placeholder image with rounded corners in a figure. + A generic square placeholder image with rounded corners in a figure.
A caption for the above image.
{% endexample %} diff --git a/scss/_images.scss b/scss/_images.scss index ac481d58d7..ffcd7086d1 100644 --- a/scss/_images.scss +++ b/scss/_images.scss @@ -40,12 +40,11 @@ .figure { // Ensures the caption's text aligns with the image. display: inline-block; +} - > img { - @extend .img-fluid; - margin-bottom: ($spacer-y / 2); - line-height: 1; - } +.figure-img { + margin-bottom: ($spacer-y / 2); + line-height: 1; } .figure-caption {