-
Notifications
You must be signed in to change notification settings - Fork 716
[css-backgrounds-4] Transformation of background images #2364
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
Comments
The feature to transform an image shouldn't be restricted to background images. It should work for all properties that take images like Therefore I'd rather change the
Example: background-image:
url("https://my.super/fancy/corner-image.svg"),
url("https://my.super/fancy/corner-image.svg") rotate(90deg),
url("https://my.super/fancy/corner-image.svg") rotate(180deg),
url("https://my.super/fancy/corner-image.svg") rotate(270deg); This could even be extended to allow to specify the transform origin:
@xfq's example could then be achieved like this: background-image:
url("https://my.super/fancy/corner-image.svg"),
url("https://my.super/fancy/corner-image.svg") scale(1, -1) center,
url("https://my.super/fancy/corner-image.svg") scale(-1, 1) center,
url("https://my.super/fancy/corner-image.svg") scale(-1, -1) center; Sebastian |
This use case will be covered by the image manipulation at-rule discussed in #6807. With that rule and the related function (names still need to be discussed) the example from above would look like this: @image --rotate-90deg { rotate: 90deg; }
@image --rotate-180deg { rotate: 180deg; }
@image --rotate-270deg { rotate: 270deg; }
background-image:
url("https://my.super/fancy/corner-image.svg"),
image(url("https://my.super/fancy/corner-image.svg"), --rotate-90deg),
image(url("https://my.super/fancy/corner-image.svg"), --rotate-180deg),
image(url("https://my.super/fancy/corner-image.svg"), --rotate-270deg); Sebastian |
@xfq It was resolved to add an Does that solve your use case or do you think we're missing something? Sebastian |
Yep, I think it solves my use case. Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
Spec: https://drafts.csswg.org/css-backgrounds-4/
Currently, there is no way to rotate or skew the background image(s) of an element with CSS, so web developers can only transform the whole element. With this feature added (by adding a
background-transform
property, for example), backgrounds like [1] might only need one small image (instead of four different ones, or a large one) and thus save some bytes.Tagging css-backgrounds-4 for now. Feel free to change it to css-transforms if it's more appropriate.
[1] https://codepen.io/chriscoyier/pen/jZBLrN
See also:
The text was updated successfully, but these errors were encountered: