Forum How do I...?

[PrinceXML v12.3] object-fit doesn’t seem to be working

twantzen
Dear all,

I tried to make an img object-fit via CSS rule, but it doesn’t behave like I’d expected it. Here is my CSS:

.theImgWrapper {
    position: absolute;
    top: 71mm;
    left: -15mm; /* img starts in bleed */
    width: 82mm;
    height: 196mm;
}
.theImgWrapper img {
    width: 82mm;
    height: 80mm;
    object-fit: cover;
    object-position: 51.183% 50%; /* respecting bleed of 3mm on a left page */
}


I expect, that the img -- regardless of portrait or landscape and it’s pixel dimensions -- is proportionally scaled up or down to fill the complete width and height of 82x80mm and is centered horizontally and vertically.

But what I get is a distorted image as if I’d never defined an object-fit. What am I doing wrong?

Thanks, Tobias
mikeday
The object-fit property was supported in Prince 13, so you may need to upgrade.
twantzen
Thanks, Mike. We definitely need to upgrade!
twantzen
BTW, Mike, the doc-ref guide of PrinceXML 12 tells me, that object-fit "cover" is available for it:
https://www.princexml.com/doc/12/doc-refs/#prop-object-fit
csant
Yes, thank you - it's a slip in the documentation, apologies.