I’m configuring a picture-elements card with a background which represents the floor layout of my home. I am struggling with the aspect ratio of the image though. The image is cut off, so part of the layout is invisible.
With simple css changes i can fix this, but i have a hard time mapping this to card_mod. As you can see: I’ve had to add height:100% to the root div and to the hui-image element, and an “object-fit: contain” to the object.
Can somebody help me map these 3 css updates to card_mod such that the css changes are pushed through the shadow dom elements?
I did find the instructions on card_mod on how to target the shadow elements, but for some reason my configuration doesn’t apply properly. Seems like I don’t really get the way to properly target the nested components.
Below you can find my current version. Note: all the styling changes, but the last one is working correct. The only element i am not able to target is the last one; the one targeting the “hui-image img”, on which i would like to set property “object-fit: contain”
This is the before and after; without object-fit contain it will fill in the image in the wrong way (will take the full width, resulting in a cutoff section at the bottom). With the object-fit contain it will make sure the image is stretched the maximum without any cutoffs.
(Don’t pay attention to the icons, they have to positioned correctly later on)
You are 100% correct for some reason the | operator after style: (to combine multiple statements) messed this up.
With only that statement it works, many thanks! I eventually went with this: