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
[object.crop] Allow images to fill container #278
Comments
@danwhite85 thank you for your feedback.
True, that's what I initially want 😋
I will make some test and keep you informed. |
FYI ... putting object-fit: cover on the child image fixes this problem... but its a property still in development at minute, it's a no show for IE/Edge but ... there are some fixes and polyfills. :( |
@aaronstezycki right but like you say we can really use it now without polyfills. The purpose of the |
@danwhite85 After reflection this isn't really a bug, so I think we can close this issue. For dynamic content (defined by user...) I advice to combine this object with a crop/resize tools for images. |
Were issues discovered with using min values? If not, I'll probably still make the change in my personal projects. I'd rather not risk having images stretched. |
@danwhite85 Using As you can see aspect ratio aren't maintain : image 2 (4:3) fill container because of So I add a third line that remove |
In fact, I think we shouldn’t specify min-width or max-width here, since this object is specifically thought for fixed ratio content, and therefore should by definition stretch content to the specified ratio if it is not sized like that. |
@anselmh thanks, your explanation is clearer 😋 @danwhite85 can we close this issue ? |
@danwhite85 why would you use a ratio object and be concerned by stretching? If you force an aspect ratio on something that has another, it's supposed to stretch. |
My concern is really only with images. I like the current functionality of ratio with iframes, video, etc. My use case is a blend between crop and ratio. I want images to fill the space of their parent (without being stretched) and the remaining is cropped out. Crop only works this way if the image is larger than its container (which I can't always verify). Maybe a different solution would be a modifier on the .o-crop class e.g:
|
@danwhite85 This is only reliably achievable with We could indeed add such |
@anselmh the --fill modifier appears to work as expected in my tests. http://codepen.io/anon/pen/YZLeyN. Not sure what I'm missing. |
@anselmh I agree with @danwhite85 that it works as expected in the test. How I see it, So having said that, the thing to figure out is if we want the crop object to not mess with the image dimensions. If so, there is no room for @inuitcss/core thoughts? |
@nenadjelovac agree. I never use this object in production because of this kind of issue with image smaller than container... |
Setting width & height to 100% on .o-ratio__content causes images to scale without maintaining their aspect ratio. Recommend setting min-width and min-height to 100% instead.
The text was updated successfully, but these errors were encountered: