OH-Cell Card and OH-Label Cell Background image

Hello,

I try to set a image as background in a oh-cell and oh label cell.

background-image: url(static/test.jpg)

  1. static path = conf/html, right ?

until now, thing is working, can someone help me ? I’m new to OH :slight_smile:

Thanks

The OH cells are specially pre-formatted widgets with several built-in background special functions (for example, the trendline). I don’t think background style parameters are passed to the base element in this case otherwise there could be some pretty common conflicts.

The OH cells, however, do offer a background slot so that you can achieve effects like this. So you want something like:

- component: oh-cell
  config:
    title: This cell has a background image
  slots:
    background:
      - component: oh-image
        config:
          url: '/static/test.jpg'

thank you … I tried but as soon as I save the code, it gets automatically deleted.

Please show the full code of the page or widget you are trying to build.

sorry if found the error, was my mistake

the slots part was not correct formated, now is work. Thank you so much for your help.

Last question, can i use also a live url as background ?

You can use any url that points to an image. You can not point to non-image locations. If you have it pointing to an image and that image changes, the widget will not change the background until it is refreshed. See here for more details:

Thank you JustinG for you support !!!

Do you have an idea how I can say the image should only display on label widget but not in the popup window ? thank you

Bildschirmfoto 2022-02-12 um 14.45.38

Add

class:
  - card-opened-fade-out

to your oh-image config

 - component: oh-image
   config:
    url: '/static/test.jpg'
    class:
      - card-opened-fade-out

thanks so much for you help … if you not familiar with coding its very difficult …

This the result, thank to you for helping me.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.