The doc for card-mod can be found here and this is a useful tool for navigating the dom structure.
As for removing the rounded borders, you should look into the CSS border-radius property. For the space, you’ll have to use your browser’s dev tools to find where that comes from in order to reduce it.
The issue is that the styles which target the h3 and h1 inside the ha-markdown element are not being applied, until I go to “Edit dashboard” and the view enters edit mode. Then the styles are applied. Then when I leave edit mode, they are still applied. If I refresh the browser, the styles are not applied anymore, until I enter edit mode. Rinse and repeat. Any ideas?
Do you guys know how to set the width of a card? I have a weatherforecast which is a bit wide I want to reduce it’s size a bit… Adding --ha-card-width: 50px; or width: 50px; does not do anything. Is there some kind of doc where all CSS variables for the card-mod are listed?
1) If I need to apply the styling in the options area of the auto-entities filter (or where else to put the card_mod section at?) and 2) How to access the icon.
Full tree is:
custom:vertical-stack-in-card
entities
custom:auto-entities
custom:bar-card
entity
icon
Hi I tried the method you’ve mention but keep getting a YAML error. Any ideas?
The style works fine when in my code but I have it in for every card and want to tidy things up.
Thanks
Happy New Year everyone. Looking at the post here, I am trying to do the exact same thing…
If any of these temperature sensors are offline, I would like the temperature to show in red. For each of the sensors above, I have 2 items: (sensor.water_room_temp & sensor.water_room_offline)…
sensor.water_room_offline gives me a 0 if it’s online or a 1 if it’s offline.
I read in that post that there are different ways to accomplish this however I would like to use card_mod and templates. I have played around with the syntax based on that thread but I just can’t seem to get it working.
Thanks so much in advance everyone and all the very best for a healthy, happy 2023!
Thank you for the reply. First post, got it. Link at the bottom, got it. That took me here. I wasn’t able to find the rest - I’m sorry.
The temperature (sensor.water_room_temp) color change is based on a completely different variable (sensor.water_room_offline). Do I need to define that variable like in this post or can I just reference it in an ‘if’ statement?
Thank you very much for your time and patience with me @ Ildar_Gabdullin. You and RobC are such a huge help to this community and I am VERY appreciative. I was making things much more complicated then they needed to be. For anyone else that may be looking to do this, here is the final code that works great…
entities:
- entity: sensor.water_room_temp
card_mod:
style:
hui-generic-entity-row:
$: |
.text-content:not(.info) {
color:
{% if is_state('sensor.water_room_offline', '1') %}
red
{% else %}
black
{% endif %}
;
}
- entity: sensor.pool_room_temp
card_mod:
style:
hui-generic-entity-row:
$: |
.text-content:not(.info) {
color:
{% if is_state('sensor.pool_room_offline', '1') %}
red
{% else %}
black
{% endif %}
;
}
- entity: sensor.bears_den_temp
card_mod:
style:
hui-generic-entity-row:
$: |
.text-content:not(.info) {
color:
{% if is_state('sensor.bears_den_offline', '1') %}
red
{% else %}
black
{% endif %}
;
}```
Using this example, also the entity name (“Network throughput”) is changed instead of only the value area.
I am applying this to an entities card inside a grid card.
Instead, one should use .text-content:not(.info):after and .text-content:not(.info) to exclude .info.
What I could not fix so far, is the entity value being aligned at the bottom (because of the invisible original value space above) which is looking quite ugly
→ Update: for this, using line-height: 0px; inside .text-content:not(.info) did the trick.
I need to change height of the weather card to be aligned with cards on the left and right.
To be more precise, I am able to adjust card height but not to have content adopted to the new size - top padding is not changed and bottom padding is broken, solution seems to me to decrease space between the icon and day or temperatures and precipitation .
So far use"