Best approach to prefix mdi:icon to state-label?

Dear all:
I’m trying to configure my first dashboard in HA based on floor plan and would like to ask if there is a way to append mdi:icon as prefix to state-label without introducing template sensors. I have some temperature/humidity readings would like to show an icon to indicate what it is, I know I can prefix text but that’s not what I want, text occupies too much space on floor plan. I know I can just use icon but than it is another element and cause scaling problem. Best to show icon and value in one element. Is there some css trick I can do to transform the text?
Many thanks in advance!

Check out this thread

1 Like

A possible way could be adding an element (“:before” css pseudo class, see examples posted above) before a label and fill it with some picture. But this could be a picture, not a mdi icon.

1 Like

Use a markdown card.

Icons can be added with <ha-icon icon="mdi:lamp"></ha-icon>

1 Like