Skip to content

SVG with .img-fluid should always be shown in fullwidth #19202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sergej2705 opened this issue Feb 15, 2016 · 6 comments
Closed

SVG with .img-fluid should always be shown in fullwidth #19202

sergej2705 opened this issue Feb 15, 2016 · 6 comments

Comments

@sergej2705
Copy link
Contributor

I think it would make sense if we extend the img-fluid-mixin with something like:

&[src$=".svg"] {
  width: 100%; // Vector-Graphics should always scale to full parent width
}

Because I think If someone uses a Vector-Graphic with .img-fluid he wants to show it in fullsize and not only in the viewBox-size.

@cvrebert
Copy link
Collaborator

This has been suggested previously (#13996), and deemed insufficiently general because it:

  • doesn't handle URLs with querystrings
  • doesn't handle URLs without extensions

Rather than using an imperfect heuristic which will cause confusion when it suddenly stops working when someone encounters one of the failure cases, we've opted to instead document the relevant IE8-10 bug and the workaround for it (http://getbootstrap.com/css/#callout-images-ie-svg ).

Note that .img-fluid should already make SVGs full-width in all other supported browsers.

We appreciate the thought though!

@sergej2705
Copy link
Contributor Author

I have made an JS Bin here: https://jsbin.com/hekonoxoba/3/edit

The SVG used will be fluid up to a width of 249px. If the column gets bigger the image will not take the full column width.

Note that .img-fluid should already make SVGs full-width in all other supported browsers.

It doesn't work if the width-attribute of the SVG is smaller then the size of the image-container.

@cvrebert cvrebert reopened this Feb 16, 2016
@cvrebert
Copy link
Collaborator

Ah, right, viewBox. Different from the IE bug.

I think If someone uses a Vector-Graphic with .img-fluid he wants to show it in fullsize and not only in the viewBox-size.

Without an additional class or something, the intention seems unclear. I can imagine reasonable cases to use .img-fluid even if the user wants the SVG to obey an intrinsic maximum size. .img-fluid prevents the image from overflowing its container until there's enough space to show it at its intrinsic size. Maybe the fact that the image is an SVG is an irrelevant detail to the user and they expect typical raster-ish behavior with respect to sizing.

Perhaps there should be a width: 100% utility class to accommodate cases such as yours.

@sergej2705
Copy link
Contributor Author

That could be an option, too.

@mdo mdo added this to the v4.0.0-alpha.3 milestone Feb 17, 2016
@cvrebert
Copy link
Collaborator

We're adding the utility class: #19234

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 6, 2016

Resolved by #19234.

@cvrebert cvrebert closed this as completed Apr 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants