Opacity only background image

Hi, I want set my cover card with an image a little bit opache.
I managed to set the opacity, but to the whole card.

This is the code:

type: entities
show_header_toggle: false
  style: |
    ha-card {
        background: url('/local/tapparella.jpg');
        background-size: 100% 200px;
          opacity: 0.6;
  - type: custom:cover-position-preset-row
    entity: cover.balcone
    reverseButtons: false
    width: 36px
    customSetpoints: true
    openPosition: 99
    midOpenPosition: 82
    midClosePosition: 51
    closePosition: 0
    customTheme: true
  - entity: cover.balcone
    name: ' '
    icon: ' '
      style: |
        :host { 
          color: blue;

I want set the opacity only the image in background.

Can you help me?


Why not just upload a background pic that already has an adjusted opacity?

May be a solution, but if I need to modify the opacity I have to change it everytile directly on the image. But thanks for alternatiy.

Thought about your issue. One method is to make a pseudo-element the same size as the parent and add opacity to that.

Here is an example:

type: custom:mushroom-template-card
entity: cover.bedroom_curtains
icon: mdi:blinds-horizontal
icon_color: ' '
primary: Test
 style: |
      ha-card {
        height: 140px !important;
        color: lime;
      ha-card:after {    
      content: "";
      background-image: url('/local/pics/space.png');
      background-size: cover;
      position: absolute;
      right: 0px;
      bottom: 0px;
      left: 0px;
      opacity: 0.2;