-
Notifications
You must be signed in to change notification settings - Fork 672
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
[css-images] object-fit: scale-down should become a flag #1578
Comments
At that point why not something like
where the first part specifies the desired filling style, and the second part specifies if the default size should be used as a clamp ( |
@Loirooriol what are the use cases for this extra complexity? We don't typically add features without use cases for the sake of completeness alone. You almost never want to scale images up because upsampling deteriorates quality. In the few cases where upsampling is ok, there is no point in restricting it with a boundary. |
I don't know many the use cases, it was just a quick idea which seemed more coherent than a standalone
And |
I have never seen anything like this in my 12 years of web dev. Most designers wouldn't be caught dead upscaling images. If it’s a "frequent thing", surely you can remember at least a couple of use cases? All I can think of is spanning header images, but that's typically done via Btw with
Is there any point to all these aliases? Bottom line is, we don’t typically add syntax without use cases. So far you have not demonstrated any use cases. If you want to continue discussing this, you need to demonstrate actual, widespread use cases. |
Yes, it's basically used in header images. Here you have an example: http://mengem.ara.cat/salut_i_nutricio/aliments-saludables-integrals-greix-sucre_0_1541246081.html. I think there is some wordpress theme with something similar. And I'm sure I saw people asking about this at stackoverflow. I disagree that header images should necessary be background images, if they are part of content and not only decorative they should be HTML images. Of course Sorry it seems I misunderstood the reasoning behind your proposal, and I have been spamming this thread longer than planned. So I better stop. |
Why would someone make a spanning header image with |
There might be other reasons, but one is it could be for a11y purposes. If your header contains text or logo, you might want to use |
The CSS Working Group just discussed
The full IRC log of that discussion<dael> Topic: object-fit: scale-down should become a flag<dael> github: https://github.com//issues/1578 <dael> fantasai: Can we do update WD of display? <dael> astearns: I thought we resolved on that. <dael> fantasai: Okay. <dael> leaverou: Currently scale down is defined as contain or none. If contain wouldr esult in enlargement it's treated as same as none. This was defined at time cover was rare. Today we have a lot of images that are treated to cover the entire background. I'm sure you recognize this, we see it over the web. THe scale down behavior would be useful, but it's deinfed as contain or none <dael> leaverou: It's unpredictable that it's defined tahat way based on the name. I suggested scale-down becomes a flag used with cover or contain. When it's on it's own it can be defined as contain. <dael> leaverou: I discussed with fantasai and she agreed. We wanted to run by the group. <dael> TabAtkins: Sounds reasonable to me <dael> astearns: Other opinions? <dael> astearns: Doesn't seem like there's a backwards compat because we can define scale-down by itesel. <dael> ??: Is there a github? <leaverou> https://github.com//issues/1578 <dael> astearns: Yes. 1578 <dael> s/??/iank <iank_> looks ok, thanks. <dael> [pause for github reading] <rachelandrew> I think this would be useful behaviour <dael> astearns: I'm not hearing objections. Lots of positives <dael> RESOLVED: Accept the change in https://github.com//issues/1578 |
Spec: https://drafts.csswg.org/css-images-3/#the-object-fit
Currently,
scale-down
is defined as a separate value:The choice of making this mean "contain or none" instead of "cover or none" is rather arbitrary and non-obvious. Furthermore, the "cover or none" use case is more common, since there is a ton of images on the web that are cropped to a square or other limited rectangle and typically you want them to cover the entire area UNLESS that would mean scaling them down, which is an absolute no-no.
For example, take a look at this:
This is currently using
object-fit: cover
, which causes the last image to be horribly enlarged, since it's just a favicon. Usingobject-fit: scale-down
would fix the last image, but break the others. There is currently no value forobject-fit
that fixes this.Therefore, I would suggest changing the grammar from
fill | contain | cover | none | scale-down
tofill | none | [contain | cover] || scale-down
andscale-down
on its own would be defined as equivalent tocontain scale-down
for backwards compat.CC @tabatkins @fantasai
The text was updated successfully, but these errors were encountered: