šŸ”¹ Card-mod - Add css styles to any lovelace card

exactly what change are your referring to?
donā€™t make us go find / seek

header, (as the element of a card) or type: heading?

both can be modified though, but you need to find the correct element to modify. check the .container.

Can even use a card-mod class and still add via card_mod style:

  - type: heading
    heading: Aanwezigheid
    heading_style: title
    card_mod:
      class: class-section-heading-no-color
      style: |
        .container {
          {% set thuis = is_state('binary_sensor.familie_thuis','on') %}
          background: {{'green' if thuis else 'dimgray'}};
          --ha-heading-card-title-color:
            {{'var(--active-color)' if thuis else 'black'}} !important;
        }

there are several more examples already in this thread/community

again, that is a false assumption.
I dont use the mushroom title card, so cant help you there (there is a dedicated mushroom style guid in the community so be sure to check that out)

suppose you want to modify the individual badges in the heading? thatā€™s also possible, check Ildars post on that subject
(as always, 1 post here, scroll to the bottom, Fantastic post) and then find the relevant post in that link

Sorry!! Iā€™m referring to the boxes of each element, they are rounded. And to the Element: Developer Tools, the text is out of line and not everything is displayed.

A yes, I see now :wink:

what settings do you use in card_mod pertaining the sidebar? Any variables you are changing?
or, in card-mod theming for that matter?

The non-wrapping of the developer tools name might be an issue in the plugin, did you already post it in the Repo of custom-sidebar? Elchininet is very active, so will probably catch that for you very promptly

I donā€™t made any changes or setting with Card Mod, i only installed it.

And yes, i asked in the Custom Sidebar Page too!

Thanks!

having a go at some badge styling in New badges and card-mod customisation - #78 by Mariusthvdb with help from great modifier @VietNgoc I figured it would benefit the crowd if I posted this here too:

from top to bottom being all core cards (badges, entities with embedded tile cards, and below that regular entities) modified by card_mod only :wink:

1 Like

seems far fetched that would immediately cause a change in the sidebarā€¦

dont see it either, but I did set several in themes and card-mod theming, so maybe override the trouble you get in your config.

Ill follow along in the repo, to see what gives there

but where did you do that, I cant find it at GitHub Ā· Where software is built

I mean I asked in the forum group! Sorry Iā€™m new to this stuff!!

Thanks for your help.

Hi,

Iā€™m trying to change the text color for the first entity in this card (a conditional type entity) as well as make it ā€œunclickableā€. Hereā€™s my attempt :

type: entities
entities:
  - type: conditional
    conditions:
      - entity: input_boolean.loraswitchcheck
        state: "off"
      - entity: sensor.avlfiller
        state: Online
    row:
      entity: switch.relay3
      icon: mdi:light-switch
      name: Relay
    card_mod:
      style:
        hui-script-entity-row $: |
          hui-generic-entity-row {
            pointer-events: none;
            color: red;
          }

Hereā€™s what Iā€™m seeing:

Iā€™m not sure what Iā€™m doing wrong here.

Thanks.

PS: Iā€™m no coder or have any experience in coding

Hello!

How can I remove some of the header space shown here?
Additionally, how can I increase this row of numbers to be the same size, or close?
image

This is what I have currently:

show_current: false
show_forecast: true
type: weather-forecast
entity: weather.home_2
forecast_type: daily
card_mod:
  style: |
    ha-card {
        border-radius: 1px;
      background-color: transparent;
       border: 0px;
       box-shadow: none;
         font-size: 20pt;
        font-weight: bold
    }
        font-size: 20pt;
        font-weight: bold
      
        

      }
      ha-card div.forecast div.temp {
        font-size: 55pt;
      }
           ha-card div.forecast div.forecast-image-icon svg {
        --mdc-icon-size: 70px;
        width: 70px;
        height: 70px
      }
      

You were right, I fixed it now. The problem was with the ā€œwhite-spaceā€ style. I just changed it in my theme settings and now it works perfectly. Thanks.

Hi,

I am working on this since days without any succcess ā€¦

Let me show you a screenshot first:

What you see is an overvie of different sensors my proxmox server offers. The bottom right card shows the status quo - the left shows what i want to achieve. On the upper left corner of the card I want to see the ID of the VM or Container. This is just the title of the card. I was able to shrink it and I was able to come close to my target this way:

card_mod:
  style:
    $: |
      .card-header {
        color: red !important;
        font-size: 12px !important;
        font-weight: bold !important;
        height: 12px !important;
        padding-top: 0px !important;
        margin-top: 0px !important;
      }

But I donā€™t find any solution how to push the red title closer to the top margin of the card. The rest of the content will follow (hopefully) and the layout will be perfect.

Any ideas how to fix this?

Thanks. Youre right that did work thats thats awesome. I guess i just need to figure out the options available for .container. Just trying to change the title to size 25 really. Previously I used " --title-font-size: 25px !important; " but this does not seem to work within .container. Thanks bud

EDIT - Figured it out
ā€“ha-heading-card-title-font-size: 29px !important;

Curious, is there a good resource for all of the options available to reference in the future? I found one specific to mushroom cards which is great but Im guessing there is a larger repository somewhere of the available options? Hopefully anyway. Thanks again!

I do not think there is a resource for available css vars. As for possible css properties - there are tons of sites.

Excuse my ignorance as I am just ā€˜faking it till I make itā€™ with this stuff but with ā€œha-heading-card-title-font-sizeā€ I basically just started guessing the end part and saw it worked. Based on the name of that being ultra specific like that, I assumed it has to be written somewhere as a reference?

You can find the source code on the frontend repo, usually the files are named by their tag nameā€¦ Somehow you will have a little idea how the compoment structure looks like. For example, in the case of heading card, look for the hui-heading-card file ā€¦

Hi,

Hoping I can get some help, I am trying to edit a padding value, I believe the issue I am having is it inside a shadowroot.

I THINK I have followed the instructions on the docs but the result is incorrect, but i cant see what I have done wrong.

Only thing I can think is Iā€™m trying to use div.XXX instead of the examples using ha-XXX, I donā€™t know enough about this stuff to know if thatā€™s an issue, or why its not working? I couldnā€™t find any examples of targeting div.container so maybe thatā€™s not how it should be done?

action: fire-dom-event
browser_mod:
  service: browser_mod.popup
  data:
    title: Aquarium
    card_mod:
      style:
        .: |
        browser-mod-popup$: |
          ha-dialog div.content div.container {
            padding: 0px 0px 0px 0px !important;
          }

here is the inspect element, If i edit the padding manually highlighted in RED, I get the correct behavior. Iā€™m just not sure how to target this value with browser mod?

And this is the padding im wanting to override:

Appreciate if anyone can point out what Iā€™m doing wrong.

And you want padding for all popups? If so, add style to your theme configā€¦

  card-mod-more-info-yaml: |
    .: |
      :host([card]) .content .container {
        padding: 0px !important;
      }

Thanks for the suggestion, I did want it for all the popup cards, though I would like to get a better understanding of how it works so if i need to apply a setting to a specific card, I can change it.

I tried your suggestion above, it didnā€™t seem to make any change?

Edit: also this is a popup card, not sure if its mentioned/makes a difference to how to solve the problem

You donā€™t need guessing. Jost open Dev-Tools in browser, look, what is used at the point, you want to change something and change exactly this.