# Texte scrolling dans mini-graph-card

**URL:** <https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685>\
**Category:** Entraide Home Assistant\
**Tags:** mini-graph-card\
**Created:** [Avril 2, 2025, 8:39 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685 "2025-04-02T08:39:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frans](https://forum.hacf.fr/user_avatar/forum.hacf.fr/frans/32/100709_2.png) [@Frans](https://forum.hacf.fr/u/Frans)\
**Post date:** [Avril 2, 2025, 8:39 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/1 "2025-04-02T08:39:06Z")

</div>

Bonjour,

Est-il possible de faire défiler un texte trop grand dans mini-graph-card ?  
Ce serait mieux que de réduire la taille du texte en question.

Merci par avance.

 ![Capture d'écran 2025-04-01 204509](https://forum.hacf.fr/uploads/default/original/3X/3/b/3b2a91ac2b8ed58a94b0348135076babee59778d.png)

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 2, 2025, 9:39 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/2 "2025-04-02T09:39:55Z")

</div>

Bonjour,

Je ne sais pas si c’est possible avec card-mod mais c’est faisable avec custom:button-card en mettant en custom\_fields ta carte custom:mini-graph-card et par dessus, un autre custom\_fields avec le texte défilant…

---

<div class="post-metadata">

**Author:** ![Frans](https://forum.hacf.fr/user_avatar/forum.hacf.fr/frans/32/100709_2.png) [@Frans](https://forum.hacf.fr/u/Frans)\
**Post date:** [Avril 2, 2025, 9:52 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/3 "2025-04-02T09:52:41Z")

</div>

Merci pour ta réponse, mais tu m’as complètement perdu là 😁

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 2, 2025, 9:53 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/4 "2025-04-02T09:53:59Z")

</div>

Je te fais un exemple, patiente juste un petit peu 😉

---

<div class="post-metadata">

**Author:** ![Frans](https://forum.hacf.fr/user_avatar/forum.hacf.fr/frans/32/100709_2.png) [@Frans](https://forum.hacf.fr/u/Frans)\
**Post date:** [Avril 2, 2025, 9:54 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/5 "2025-04-02T09:54:44Z")

</div>

Tkt je part au taf, c’est pas urgent.

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 2, 2025, 9:55 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/6 "2025-04-02T09:55:29Z")

</div>

Je te poste un exemple commenté dans l’aprèm

---

<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:** [Avril 2, 2025, 10:07 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/7 "2025-04-02T10:07:49Z")

</div>

Bonjour,  
avec card\_mod:

```yaml
card_mod:
  style: |
    ha-card .header.flex .name.flex {
      display: inline-block;
      animation: marquee 5s linear infinite !important; 
    }
    @keyframes marquee {
      0% { transform: translate(0, 0); }
      100% { transform: translate(-100%, 0); }
    } 	

```

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 2, 2025, 12:28 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/8 "2025-04-02T12:28:52Z")

</div>

Un exemple de ce qui est faisable avec custom:button-card (c'est le logiciel de capture de gif qui donne l'effet saccadé)...

![essai](https://forum.hacf.fr/uploads/default/original/3X/0/0/000b08e3ea921db7ba44e1eccf8e5c811177e411.gif)

le code :

```yaml
type: custom:button-card
entity: sensor.perron_thermometre_exterieur_temperature
custom_fields:
  scrolling_text: |
    [[[
      return `<div class="scrolling-container">
                <div class="scrolling-text">
                  ${entity.attributes.friendly_name} &#x2003; ${entity.attributes.friendly_name}
                </div>
                <div class="scrolling-text">
                  ${entity.attributes.friendly_name} &#x2003; ${entity.attributes.friendly_name}
                </div>
              </div>`;
    ]]]
  bottom_card:
    card:
      type: custom:mini-graph-card
      entities:
        - sensor.perron_thermometre_exterieur_temperature
      hours_to_show: 24
      points_per_hour: 1
      show:
        labels: true
        labels_secondary: true
      color_thresholds:
        - value: 0
          color: "#ff0000"
        - value: 20
          color: "#00ff00"
styles:
  card:
    - height: 170px
    - width: 300px
    - position: relative
  custom_fields:
    scrolling_text:
      - position: absolute
      - top: 11px
      - left: 17px
      - width: 80%
      - height: 28px
      - overflow: hidden
      - background-color: rgba(255, 255, 255, 1.0)
      - z-index: 2
    bottom_card:
      - position: absolute
      - bottom: 0
      - left: 0
      - width: 100%
      - z-index: 1
extra_styles: |
  .scrolling-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
  }
  .scrolling-text {
    display: inline-block;
    min-width: fit-content;
    padding-right: 20px;
    animation: scrolling 8s linear infinite;
    background: linear-gradient(to right, rgba(255, 255, 255, 1) 0px, rgba(255, 255, 255, 0) 10px, rgba(255, 255, 255, 0) calc(100% - 10px), rgba(255, 255, 255, 1) 100%);
  }
  @keyframes scrolling {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
  }

```

Un autre exemple avec un effet de fondu au blanc en début et fin de zone de texte défilant :

![essai](https://forum.hacf.fr/uploads/default/original/3X/2/0/2026d8873b6b92062bf520d3a913a4c8854f1682.gif)

Le code :

```yaml
type: custom:button-card
entity: sensor.perron_thermometre_exterieur_temperature
custom_fields:
  scrolling_text: |
    [[[
      const friendlyName = `${entity.attributes.friendly_name}`;
      return `
        <div class="scrolling-container">
          <div class="scrolling-text">
            ${friendlyName} &#x2003; ${friendlyName}
          </div>
          <div class="scrolling-text">
            ${friendlyName} &#x2003; ${friendlyName}
          </div>
        </div>
      `;
    ]]]
  fade_start:
    card:
      type: custom:button-card
      styles:
        card:
          - border: none
          - border-radius: 0%
          - background: >-
              linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255,
              255, 255, 0) 100%)
          - width: 10px
          - height: 28px
          - z-index: 3
  fade_end:
    card:
      type: custom:button-card
      styles:
        card:
          - border: none
          - border-radius: 0%
          - background: >-
              linear-gradient(to left, rgba(255, 255, 255, 1) 0%, rgba(255, 255,
              255, 0) 100%)
          - width: 20px
          - height: 28px
          - z-index: 3
  bottom_card:
    card:
      type: custom:mini-graph-card
      entities:
        - sensor.perron_thermometre_exterieur_temperature
      hours_to_show: 24
      points_per_hour: 1
      show:
        labels: true
        labels_secondary: true
      color_thresholds:
        - value: 0
          color: "#ff0000"
        - value: 20
          color: "#00ff00"
styles:
  card:
    - height: 170px
    - width: 300px
    - position: relative
  custom_fields:
    scrolling_text:
      - position: absolute
      - top: 11px
      - left: 17px
      - width: 80%
      - height: 28px
      - overflow: hidden
      - background-color: rgba(255, 255, 255, 1.0)
      - z-index: 2
    bottom_card:
      - position: absolute
      - bottom: 0
      - left: 0
      - width: 100%
      - z-index: 1
    fade_start:
      - position: absolute
      - top: 11px
      - left: 17px
    fade_end:
      - position: absolute
      - top: 11px
      - right: 13%
extra_styles: |
  .scrolling-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
  }
  .scrolling-text {
    display: inline-block;
    min-width: fit-content;
    padding-right: 20px;
    animation: scrolling 8s linear infinite;
  }
  @keyframes scrolling {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
  }

```

Si la version avec card\_mod de @WarC0zes te convient, utilise-la.

Si tu veux des explications sur le(s) code(s) que je t'ai mis, demande-le moi

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 2, 2025, 1:45 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/9 "2025-04-02T13:45:24Z")

</div>

@WarC0zes

Arfff mémoire de poisson rouge 😁

c’est quelle balise qu’il faut mettre ?

---

<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:** [Avril 2, 2025, 1:47 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/10 "2025-04-02T13:47:13Z")

</div>

c'est la balise texte préformaté toujours, mais sur la première balise ``` tu ajoutes yaml  
 ![image](https://forum.hacf.fr/uploads/default/original/3X/6/3/63857add29f3edcd68712408217113fe413e980d.png)

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 2, 2025, 1:48 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/11 "2025-04-02T13:48:12Z")

</div>

Oui, c’est bien ce que tu m’avais déjà dis 🙃 ça finira bien par rentrer 🤡

---

<div class="post-metadata">

**Author:** ![Frans](https://forum.hacf.fr/user_avatar/forum.hacf.fr/frans/32/100709_2.png) [@Frans](https://forum.hacf.fr/u/Frans)\
**Post date:** [Avril 2, 2025, 7:25 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/12 "2025-04-02T19:25:33Z")

</div>

Merci a vous @anon51798830 et @WarC0zes.

je vais prendre la solution de WarC0zes, qui dans un premier temps et beaucoup plus simple et rapide.

Quand j’aurais un peu plus de temps je vais me mettre sur la solution de Cleya.

Etant nouveau ici, je ne sais pas a qui donner la solution ?

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Avril 3, 2025, 5:53 UTC](https://forum.hacf.fr/t/texte-scrolling-dans-mini-graph-card/60685/13 "2025-04-03T05:53:59Z")

</div>

Ben à @WarC0zes 😁 si cette solution te va
