I’ve started to implement a plugin. I’m having problem with background-images of elements. I can set background-image property in CSS and i’m able to see that image as background but the problem is i can’t position or resize background images using background-size and background-position properties. Those props don’t affect at all. I can see those props are supported in docs though.
In this way, background image not covered and position is not centered. It’s always starts positioning from left-top and sizes as original size. I always have same view whether i use background-size and background-position or not use.
Shorthand properties also doesn’t work for background.
background: url(*[imageUrl]*) no-repeat cover;
Basically i’m trying to center and cover an image into an element with fixed dimensions. I tried using background-image as well as img element inside parent. Their behavior is not same as browser and seems like i’m unable to do what i want in XD environment.
I appreciate any suggestions for centering and covering (either landscape or portrait) an image inside parent.
Improved background position and sizing is coming to an XD release near you soon.
That said, in XD 17, at least, I can’t replicate your issue with background-size – cover and contain work as expected. The position, however, can’t be modified yet (until the release that I allude to above).
According to CSS support · Adobe XD Plugin Reference, while the background-repeat property itself is supported, every repeat value (repeat, repeat-x, and repeat-y) is declared “UNSUPPORTED”. Assuming that the documentation is up-to-date, it therefore appears to not really be supported