# HTML in (gauge) label

**URL:** https://discourse.nodered.org/t/html-in-gauge-label/48138
**Category:** Dashboard
**Created:** [7 July 2021 13:38 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138 "2021-07-07T13:38:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![rucksman007](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rucksman007](https://discourse.nodered.org/u/rucksman007)
#### Post date: [7 July 2021 13:38 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/1 "2021-07-07T13:38:56Z")

</div>

I want to center the label text for a gauge label because I have a line break in the label text, and centered the label looks much better than aligned left. So I tried something like `<div style='text-align: center'>{{msg.mylabeltext}}</div>`. Unfortunately this does not work, only the

 and the label text show up in the dasboard, the style part is missing. Why is that? Things like `<font color="red">{{msg.payload}}</font>` do work though. Is there a rule what works and what not?

As a workaround I tried to use a template node and create a specific class for that. But that is not an ideal solution either as I use more than one gauge on the page and I want only this gauge to have this centered two line label.

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [7 July 2021 15:45 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/2 "2021-07-07T15:45:45Z")

</div>

Using classes is way better than any other solution. 🙂  
Replace the id with the real id of the `md-card` that contains the gauge.

```auto
  [node-id="aa10b14b6e530709"] > p {
    width:100px !important;
    text-align:center !important;
    display:flex !important;
    margin: 6px 0px 10px 0px !important;
  }

```

---

<div class="post-metadata">

### Author: ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)
#### Post date: [17 July 2021 08:26 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/3 "2021-07-17T08:26:26Z")

</div>

> [@hotNipi](#):
>
> `> p`

What is the significance of this part? I have seen it listed differently for a button hover use case

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 July 2021 09:01 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/4 "2021-07-17T09:01:45Z")

</div>

The `>` means elements inside

The `p` means find `<p>` (paragraph) tags

So essentially, the whole CSS selector states find the element with that node ID then looks inside it for any paragraph tags.

[https://www.w3schools.com/cssref/sel\_element\_gt.asp](https://www.w3schools.com/cssref/sel_element_gt.asp)

---

<div class="post-metadata">

### Author: ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)
#### Post date: [17 July 2021 09:04 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/5 "2021-07-17T09:04:21Z")

</div>

Thanks... Googling `> p` just didn't do the job as it somehow linked to the singer P!NK 😛

---

<div class="post-metadata">

### Author: ![rucksman007](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rucksman007](https://discourse.nodered.org/u/rucksman007)
#### Post date: [18 July 2021 15:50 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/6 "2021-07-18T15:50:07Z")

</div>

> [@hotNipi](#):
>
> Replace the id with the real id of the `md-card` that contains the gauge.

Thanks for your answer. I'm pretty busy at work, so I can only reply now. Isn't the node ID volatile? Is there a way to give the p-tag inside the md-card it's own id?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 August 2021 15:51 UTC](https://discourse.nodered.org/t/html-in-gauge-label/48138/7 "2021-08-17T15:51:06Z")

</div>

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