# Custom flower card et card mod: impossible de changer une marge

**URL:** <https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505>\
**Category:** Entraide Home Assistant\
**Tags:** interface-lovelace, aide, carte-personalise-custom-card, card-mod\
**Created:** [Janvier 11, 2023, 5:01 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505 "2023-01-11T17:01:38Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![BBE](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bbe/32/64915_2.png) [@BBE](https://forum.hacf.fr/u/BBE)\
**Post date:** [Janvier 11, 2023, 5:01 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/1 "2023-01-11T17:01:38Z")

</div>

## Mon problème

Bonjour à tous et merci d'avance!

J'ai installé une carte Custom flower card et je ne parviens pas à la modifier comme je souhaiterai avec card-mod:

La carte par defaut est comme ceci:

 ![image](https://forum.hacf.fr/uploads/default/original/3X/1/c/1c390cf48fd7a28bae0e8af861281b9ab6a254d8.png)

Afin de conserver au minimum l'homogeneité avec mes cartes mushroom, j'ai tenté de réduire l'image, et avec le code suivant, je suis parvenu à ça:

```auto
type: vertical-stack
cards:
  - type: custom:mod-card
    style:
      .: |
        :host {
          --text-divider-color: var(--primary-color);
          --text-divider-line-size: 2px;
        }
    card:
      type: custom:text-divider-row
      text: Salon & RdC
      align: left
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        icon: mdi:arrow-right
        icon_color: grey
        content: détails
        tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/salon
        hold_action:
          action: navigate
          navigation_path: /lovelace-smartphone/salon
      - type: template
        entity: sensor.echo_jeanne_temperature
        icon: |-
          {% if states('sensor.echo_jeanne_temperature')|float < 17 %} 
           mdi:thermometer-alert
          {% elif states('sensor.echo_jeanne_temperature')|float > 25 %} 
           mdi:thermometer-alert
          {% else %}
          mdi:thermometer
          {% endif %}
        content: '{{ states(''sensor.echo_jeanne_temperature'')}} °C '
        icon_color: |-
          {% if states('sensor.echo_jeanne_temperature')|float < 17 %} 
           light-blue
          {% elif states('sensor.echo_jeanne_temperature')|float > 25 %} 
           orange
          {% else %}
          green
          {% endif %}
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/temperatures
        tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/temperatures
        hold_action:
          action: more-info
      - type: template
        entity: sensor.echo_dot_cuisine_temperature
        icon: |-
          {% if states('sensor.echo_dot_cuisine_temperature')|float < 17 %} 
           mdi:thermometer-alert
          {% elif states('sensor.echo_dot_cuisine_temperature')|float > 25 %} 
           mdi:thermometer-alert
          {% else %}
          mdi:thermometer
          {% endif %}
        content: '{{ states(''sensor.echo_dot_cuisine_temperature'')}} °C '
        icon_color: |-
          {% if states('sensor.echo_dot_cuisine_temperature')|float < 17 %} 
           light-blue
          {% elif states('sensor.echo_dot_cuisine_temperature')|float > 25 %} 
           orange
          {% else %}
          green
          {% endif %}
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/temperatures
        tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/temperatures
        hold_action:
          action: more-info
      - type: template
        entity: binary_sensor.echo_salon_mouvement
        icon: |-
          {% if is_state('binary_sensor.echo_salon_mouvement', 'on') %} 
           mdi:motion-sensor
          {% elif is_state('binary_sensor.echo_salon_mouvement', 'off') %} 
           mdi:motion-sensor-off
          {% else %}
          mdi:chat-question
          {% endif %}
        icon_color: |-
          {% if is_state('binary_sensor.echo_salon_mouvement', 'on') %} 
           red
          {% elif is_state('binary_sensor.echo_salon_mouvement', 'off') %} 
           green
          {% else %}
           orange
          {% endif %}
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/securite
        tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/securite
        hold_action:
          action: more-info
      - type: template
        entity: binary_sensor.echo_cuisine_mouvement
        icon: |-
          {% if is_state('binary_sensor.echo_cuisine_mouvement', 'on') %} 
           mdi:motion-sensor
          {% elif is_state('binary_sensor.echo_cuisine_mouvement', 'off') %} 
           mdi:motion-sensor-off
          {% else %}
          mdi:chat-question
          {% endif %}
        icon_color: |-
          {% if is_state('binary_sensor.echo_cuisine_mouvement', 'on') %} 
           red
          {% elif is_state('binary_sensor.echo_cuisine_mouvement', 'off') %} 
           green
          {% else %}
           orange
          {% endif %}
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/securite
        tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/securite
        hold_action:
          action: more-info
  - square: false
    columns: 3
    type: grid
    cards:
      - type: custom:mushroom-cover-card
        entity: cover.volet_du_salon_apero
        show_buttons_control: false
        fill_container: false
        name: Volet Apero
        layout: vertical
        hold_action:
          action: more-info
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/volets
        tap_action:
          action: toggle
      - type: custom:mushroom-cover-card
        entity: cover.volet_du_salon_tv
        show_buttons_control: false
        name: Volet TV
        layout: vertical
        tap_action:
          action: toggle
        hold_action:
          action: more-info
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/volets
      - type: custom:mushroom-cover-card
        entity: cover.volet_cuisine
        name: Volet Cuisine
        layout: vertical
        tap_action:
          action: toggle
        hold_action:
          action: more-info
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/volets
      - type: custom:mushroom-entity-card
        entity: switch.0x00124b0024c09832
        icon: mdi:lightbulb
        tap_action:
          action: toggle
        name: Cerisier
        icon_color: orange
        layout: vertical
      - type: custom:mushroom-entity-card
        entity: switch.0x00124b0024c2793e
        name: Elephants
        tap_action:
          action: toggle
        icon_color: orange
        layout: vertical
      - type: custom:mushroom-light-card
        entity: light.0x84ba20fffe4b2581
        name: Petite lampe
        fill_container: false
        show_brightness_control: false
        show_color_temp_control: false
        collapsible_controls: false
        double_tap_action:
          action: more-info
        layout: vertical
      - type: custom:mushroom-media-player-card
        entity: media_player.echo_jeanne
        layout: vertical
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/echo
        name: Echo - salon
      - type: custom:mushroom-media-player-card
        entity: media_player.echo_dot_jeanne
        layout: vertical
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/echo
        name: Echo cuisine
      - type: custom:mushroom-media-player-card
        entity: media_player.jeanne_echo_dot
        layout: vertical
        double_tap_action:
          action: navigate
          navigation_path: /lovelace-smartphone/echo
        name: Echo SdB
      - type: custom:mushroom-cover-card
        entity: cover.volet_du_bureau
        layout: vertical
      - type: custom:mushroom-entity-card
        entity: switch.prise_tradfri_1
        icon: mdi:pine-tree
        name: Sapin - crèche
        layout: vertical
        tap_action:
          action: toggle
        icon_color: yellow
      - type: custom:mushroom-light-card
        entity: light.ampoule_bureau
        name: Bureau
        layout: vertical
        tap_action:
          action: toggle
        hold_action:
          action: more-info
  - type: custom:flower-card
    entity: plant.alocatia
    show_bars:
      - moisture
      - temperature
      - illuminance
      - conductivity
    battery_sensor: sensor.alocasia_zebrina_battery
    card_mod:
      style: |
        ha-card {
          margin-top: 4px;
        }
        ha-card > div.header > img {
          width: 40px;
          height: 40px;
          margin-top: 8px;
        }
        ha-card {
          margin-top: 0px;
        }

```

 ![image](https://forum.hacf.fr/uploads/default/original/3X/0/2/029dbc68a0596b47e77bc4dd7034cf7f6ce2b6bc.png)

Mais quoi que je tente, malgré de multiples visionnages de la video de @Clemalex là:

> [@Personnaliser ses cartes avec Card-mod](https://forum.hacf.fr/t/personnaliser-ses-cartes-avec-card-mod/4447/2):
>
> [[Card-mod et la navigation] ](https://www.youtube.com/watch?v=nKGljoXTAjs) Code de la carte météo : [image] type: weather-forecast entity: weather.maison show\_forecast: true secondary\_info\_attribute: pressure card\_mod: style: \> .temp-attribute{color:green;} .forecast \> div:nth-child(5){filter: blur(5px);} .forecast \> div:nth-child(5):hover{filter: blur(0);cursor: crosshair;} ha-card \> div.forecast \> div:nth-child(1) \> div:nth-child(1), ha-card \> div.forecast \> div:nth-child(2) \> div:nth-child(1), …

_Je ne parviens pas à me débarrasser de la marge de 32px qui se crée au dessus de cette flower card._

## Ma configuration

* * *

[center]

## System Information

| version | core-2023.1.2 |
| --- | --- |
| installation\_type | Home Assistant OS |
| dev | false |
| hassio | true |
| docker | true |
| user | root |
| virtualenv | false |
| python\_version | 3.10.7 |
| os\_name | Linux |
| os\_version | 5.15.76-v8 |
| arch | aarch64 |
| timezone | Europe/Paris |
| config\_dir | /config |

> **Home Assistant Community Store**
>
> | GitHub API | ok |
> | --- | --- |
> | GitHub Content | ok |
> | GitHub Web | ok |
> | GitHub API Calls Remaining | 5000 |
> | Installed Version | 1.29.1 |
> | Stage | running |
> | Available Repositories | 1200 |
> | Downloaded Repositories | 19 |

> **Home Assistant Cloud**
>
> | logged\_in | false |
> | --- | --- |
> | can\_reach\_cert\_server | ok |
> | can\_reach\_cloud\_auth | ok |
> | can\_reach\_cloud | ok |

> **Home Assistant Supervisor**
>
> | host\_os | Home Assistant OS 9.4 |
> | --- | --- |
> | update\_channel | stable |
> | supervisor\_version | supervisor-2022.12.1 |
> | agent\_version | 1.4.1 |
> | docker\_version | 20.10.19 |
> | disk\_total | 228.5 GB |
> | disk\_used | 18.7 GB |
> | healthy | true |
> | supported | true |
> | board | rpi3-64 |
> | supervisor\_api | ok |
> | version\_api | ok |
> | installed\_addons | Terminal & SSH (9.6.1), Let's Encrypt (4.12.7), File editor (5.4.2), Samba share (10.0.0), Home Assistant Google Drive Backup (0.110.1), Mosquitto broker (6.1.3), Zigbee2MQTT (1.29.1-1) |

> **Dashboards**
>
> | dashboards | 2 |
> | --- | --- |
> | resources | 15 |
> | views | 16 |
> | mode | storage |

> **Recorder**
>
> | oldest\_recorder\_run | 8 janvier 2023 à 00:15 |
> | --- | --- |
> | current\_recorder\_run | 11 janvier 2023 à 12:20 |
> | estimated\_db\_size | 3801.47 MiB |
> | database\_engine | sqlite |
> | database\_version | 3.38.5 |

[/center]
* * *

---

<div class="post-metadata">

**Author:** ![WarC0zes](https://forum.hacf.fr/user_avatar/forum.hacf.fr/warc0zes/32/137471_2.png) [@WarC0zes](https://forum.hacf.fr/u/WarC0zes)\
**Post date:** [Janvier 11, 2023, 6:22 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/2 "2023-01-11T18:22:04Z")

</div>

Bonjour,  
tu peu utiliser [GitHub - custom-cards/stack-in-card: 🛠 group multiple cards into one card without the borders](https://github.com/custom-cards/stack-in-card) qui colle les cartes entre elle avec divers options.  
ou [GitHub - ofekashery/vertical-stack-in-card: 📐 Home Assistant Card: Similar to vertical/horizontal-stack, but removes card borders](https://github.com/ofekashery/vertical-stack-in-card).

ou

```auto
  - square: false
    columns: 3
    type: grid
    card_mod:
      style: |
        ha-card {
          top: -20px;
        }

```

---

<div class="post-metadata">

**Author:** ![Bob](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bob/32/64908_2.png) [@Bob](https://forum.hacf.fr/u/Bob)\
**Post date:** [Janvier 11, 2023, 6:23 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/3 "2023-01-11T18:23:01Z")

</div>

Bonsoir @BBE,  
Je n’utilise aucune de ces cartes mais as-tu essayé avec l’inspecteur de code de ton navigateur de modifier ? N’y a t-il pas une classe associée à ce ha-card ?  
Ex :  
`<ha-card class="type-history-graph">`  
Sinon essaie ceci :

```auto
ha-card {
    margin-top: -30px !important;
}

```

Par contre ça risque d’impacter les autres dashboard !  
C’est juste pour vérifier que tu tapes sur le bon élément, perso dans le cadre de HA je fais très peu de CSS.

Bob

---

<div class="post-metadata">

**Author:** ![BBE](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bbe/32/64915_2.png) [@BBE](https://forum.hacf.fr/u/BBE)\
**Post date:** [Janvier 11, 2023, 6:27 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/4 "2023-01-11T18:27:15Z")

</div>

Si, l’inspecteur de code c’est ce que j’ai tenté. Mon margin top 0px est écrasé par une autre venant de je ne sais où.

L’empilement des classes est un peu déroutant dans cette carte.

Je vais tenter le !important

---

<div class="post-metadata">

**Author:** ![WarC0zes](https://forum.hacf.fr/user_avatar/forum.hacf.fr/warc0zes/32/137471_2.png) [@WarC0zes](https://forum.hacf.fr/u/WarC0zes)\
**Post date:** [Janvier 11, 2023, 6:31 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/5 "2023-01-11T18:31:15Z")

</div>

> [@BBE](#):
>
> ```auto
> card_mod:
> style: |
> ha-card {
> margin-top: 4px;
> }
> ha-card > div.header > img {
> width: 40px;
> height: 40px;
> margin-top: 8px;
> }
> ha-card {
> margin-top: 0px;  
> }
> 
> ```

c’est quoi le but d’avoir deux `margin-top:` ?

---

<div class="post-metadata">

**Author:** ![BBE](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bbe/32/64915_2.png) [@BBE](https://forum.hacf.fr/u/BBE)\
**Post date:** [Janvier 11, 2023, 6:34 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/6 "2023-01-11T18:34:46Z")

</div>

Oups.

> c’est quoi le but d’avoir deux `margin-top:` ?

le premier était un padding top... J'ai collé une vieille version...

J'ai tenté ça :

```auto
type: custom:mod-card
card:
  type: custom:flower-card
  entity: plant.alocatia
  show_bars:
    - moisture
    - temperature
    - illuminance
    - conductivity
  battery_sensor: sensor.alocasia_zebrina_battery
  card_mod:
    style: |
      ha-card > div.header {
        padding-top: 0px;
      }
      ha-card > div.header > img {
        width: 40px;
        height: 40px;
        margin-top: 8px;
      }
      ha-card {
        margin-top: 0px !important;
      }

```

et le resultat est satisfaisant !!

Merci à tous pour l'aide !

 ![image](https://forum.hacf.fr/uploads/default/original/3X/4/3/433ae9af52b1b0c8f37b932f0ffb192c403a358e.png)

---

<div class="post-metadata">

**Author:** ![Bob](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bob/32/64908_2.png) [@Bob](https://forum.hacf.fr/u/Bob)\
**Post date:** [Janvier 11, 2023, 6:39 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/7 "2023-01-11T18:39:35Z")

</div>

Il n’y a pas d’impact sur d’autres dashboard ?

Bob

---

<div class="post-metadata">

**Author:** ![BBE](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bbe/32/64915_2.png) [@BBE](https://forum.hacf.fr/u/BBE)\
**Post date:** [Janvier 11, 2023, 7:07 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/8 "2023-01-11T19:07:02Z")

</div>

J’ai fait le tour. Rien qui ne saute aux yeux…

---

<div class="post-metadata">

**Author:** ![Sylvain\_G](https://forum.hacf.fr/user_avatar/forum.hacf.fr/sylvain_g/32/1528_2.png) [@Sylvain\_G](https://forum.hacf.fr/u/Sylvain_G)\
**Post date:** [Avril 28, 2023, 10:35 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/9 "2023-04-28T10:35:36Z")

</div>

Bonjour @BBE , est-ce que tu pourrais préciser comment tu as installer la carte Custom Flower Card.

J'ai bien installer card-mod et card-tools et suivi ce tuto :

> **[GitHub - remkolems/lovelace-flower-card](https://github.com/remkolems/lovelace-flower-card)**
>
> Contribuez au développement de remkolems/lovelace-flower-card en créant un compte sur GitHub.

Mais j'ai toujours ce message :

 ![image](https://forum.hacf.fr/uploads/default/original/3X/1/0/10fd97e560ad6aa246051283d4cd84d40675324b.png)

Je désespère ...

---

<div class="post-metadata">

**Author:** ![ClassicRed](https://forum.hacf.fr/user_avatar/forum.hacf.fr/classicred/32/27071_2.png) [@ClassicRed](https://forum.hacf.fr/u/ClassicRed)\
**Post date:** [Avril 28, 2023, 1:46 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/10 "2023-04-28T13:46:02Z")

</div>

Hello  
@Sylvain_G , j'ai deja eu des soucis similaire avec d'autre addons de hacs  
pour cela je suis retourné dans hacs et retelecharger

et cela a fonctionné

J'ai teste la card , meme souci  
par contre j'ai trouvais ceci

> **[Error with custom lovelace card (MiFlora Flower Card by thomasloven)](https://community.home-assistant.io/t/error-with-custom-lovelace-card-miflora-flower-card-by-thomasloven/182333/6)**
>
> I think I may have found a solution. I noticed that my data.js wasn’t loading, thus we get this error. In flower-card.js the location is hardcoded: import {FlowerData} from '/local/lovelace-flower-card/data/data.js'; So I’ve changed it to...

---

<div class="post-metadata">

**Author:** ![BBE](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bbe/32/64915_2.png) [@BBE](https://forum.hacf.fr/u/BBE)\
**Post date:** [Avril 29, 2023, 9:22 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/11 "2023-04-29T09:22:10Z")

</div>

Je suis pas chez moi. Je n’ai pas d’accès facile à un PC pour vérifier quelle flower card j’ai installé…

Je me souviens avoir un peu galéré à l’installation.

Depuis ça roule…

Je vous dit ça d’ici quelques jours…

---

<div class="post-metadata">

**Author:** ![Sylvain\_G](https://forum.hacf.fr/user_avatar/forum.hacf.fr/sylvain_g/32/1528_2.png) [@Sylvain\_G](https://forum.hacf.fr/u/Sylvain_G)\
**Post date:** [Avril 30, 2023, 10:30 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/12 "2023-04-30T10:30:53Z")

</div>

Après un peu de galère, j'arrive bien à voir le fichier flower-card.js dans la fenêtre de débogage de mon navigateur Chrome :

 ![image](https://forum.hacf.fr/uploads/default/original/3X/6/a/6a4c3d23bf1666c74ddb961f6ee702fa5664fac6.png)

Mais le contenu semble étonnant :

 ![image](https://forum.hacf.fr/uploads/default/original/3X/5/c/5c6ba368b71b9cc4606de528a65dae7d93855284.png)

Pourtant, les fichiers crad-mod.js et card-tools.js sont correctement visibles et identiques aux fichiers dans config :  
exemple pour card-tools.js dans Chrome :

 ![image](https://forum.hacf.fr/uploads/default/original/3X/3/f/3fa0817d9238d385188858aa23523fa6e68b110e.png)

extrait de card-tools.js de config dans VS-Code :

 ![image](https://forum.hacf.fr/uploads/default/original/3X/e/e/eea5972bb68b968b69cd18fbbf610db017186492.png)

---

<div class="post-metadata">

**Author:** ![Sylvain\_G](https://forum.hacf.fr/user_avatar/forum.hacf.fr/sylvain_g/32/1528_2.png) [@Sylvain\_G](https://forum.hacf.fr/u/Sylvain_G)\
**Post date:** [Avril 30, 2023, 2:24 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/13 "2023-04-30T14:24:21Z")

</div>

Je me répond, ayant trouver la solution :  
Il fallait vider le cache du navigateur dans les paramètres, un simple CTRL + F5 ne suffisait pas.

---

<div class="post-metadata">

**Author:** ![BBE](https://forum.hacf.fr/user_avatar/forum.hacf.fr/bbe/32/64915_2.png) [@BBE](https://forum.hacf.fr/u/BBE)\
**Post date:** [Mai 2, 2023, 8:39 UTC](https://forum.hacf.fr/t/custom-flower-card-et-card-mod-impossible-de-changer-une-marge/19505/14 "2023-05-02T08:39:57Z")

</div>

Pour les suivants: sous chrome il y a une façon "simple" de vider le cache:

- on appui sur F12 ce qui affiche la fenêtre de codage
- on fait un click droit sur l'icone de rechargement de la page  
 ![image](https://forum.hacf.fr/uploads/default/original/3X/9/d/9d661fdd158395d731c352062f25065d8d3b4aef.png)
- on peut alors cliquer sur "vider le cache et faire une actualisation forcée"  
C'est souvent plus rapide que d'aller fouiller dans les menus
