The question asked here is more of a card_mod question so linking it here as I have the same question if someone has the style change figured out? Removing the tabs from the glance cards that were add in the last HA release?
Any idea why this is not working?
The “wind” icon always jumps to the next line when the view narrows. I would like to put the chevron in a very narrow “container” so there’s always enough space for the 3 chips on the left side.
Would anybody here know how to use card mod with browser mod so when I get my pop-up window it does NOT open full screen on my iPhone. I asked in the browser mode forum and I have got no response Except for one person with card mod coding that didn’t work
Because you specified a path for the 1st element (of some type) only. Read this.
If your are using rows of different types (sensor-entity, text-entity, number-entity, …) - then probably easier to specify card-mod for each row - see example below.
But if you want to specify styles on the card-level (like you tried) - then you paths should be changed.
Your code:
hui-text-entity-row $: |
hui-generic-entity-row {
creates a “card-mod” element in the shadowRoot of the 1st element (of this type) only.
Use this instead:
Thank you for supplying all these examples, this made it so much easier to understand the card-mod in combination with the numberbox card. I encountered one small issue with example from the section Custom secondary_info. The character \A was not behaving as expected (at least in my config). Any text after \A was still shown on the same line. The issue was solved for me by adding the following property: white-space: pre-wrap;
@Ildar_Gabdullin That’s perfect, thank you so much. Who would have thought that such a minor change would make such a big difference!
However I have just gone through your explanation and example and yes, I see that using the card_mod reference on each line is a better way to do it. Thanks again for taking the time to explain all this, I really appreciate it.
It depends.
Sometimes it is better to add some code in ONE place than placing it in many places.
Assume that you got some views (or dashboards) which are shown in different devices:
– your dev PC;
– mobile phone;
– wall-mount tablet - and here you need these these large fonts & row heights.
Means - sizes should be device-dependent.
Then you probably need to specify styles using “mediaquery” selector - some style is specified differently dependingly on viewport’s size.
Next, since you got several cards where you need to increase elements’ sizes - you need to repeat same code many times.
A possible solution is - specify styles for these adjustable cards (let it be Entities, Glance, etc) once in one place - card-mod theme (so called “card-mod classes”), then use these classes in views displayed on different viewports. And here you will have to specify card-mod styles on the card’s level instead on some row’s level (if talking about Entities card).
Hope this was clear. Sorry for non-native English.
P.S. Miranda, thanks a lot for buying a coffee ! )))
In your case you tried to add ONE MORE LINE - i.e. to create a multiline string.
See a difference between content: "Warning\A" & content: "Critical\A Line 2".
Then you made a mistake - the “\A” is missing BEFORE the original secondary-info value (which is hidden):
Wrong indentation are distorted in the forum post, everything is fine in my configuration. Thanks for the advice on compatibility with Apple devices, but in the presented variants, without displaying the design on another card, this does not work. Maybe there will be other tips on this problem?
In my own configuration I’m using if and else statements to dynamically change the multi-line text of secondary info and not static multi-line strings (see down below in Example 4). I wasn’t sure if/ how you could use an if statement directly with secondary_info so I used the old method of ::before. My bad if it is actually possible to use if statements within secondary_info, because that would be the preferred solution. Could you point me in the right direction if it’s possible to implement an if statement directly into secondary_info?
I’m not sure if I misunderstood your explanation but the given example of content: "Critical\A Danger\A"; only works for me when the white-space: pre-wrap; is added, which wasn’t added in the original example. Adding only \A at the end of the content does not solve this issue (Example 2). Additionally, by adding \A at the end you won’t be able to use ::after properly anymore because the transparant last_changed text is moved over to the next line (Example 3). I’m not sure why someone would want to use ::after, but it’s good to know in case someone wants to use it.
Example 1: Dynamic text
Maybe it’s possible to do something similar directly in secondary_info?
Example 3: With pre-wrap, with \A, and with a 3rd line using ::after
The transparant last_changed information has moved over to the next line by using \A at the end of Line 2. This causes Line 3 to move over.
Q1: Ca I get the entity names colored individually? I got it for the icons but cannot get the names
Q2: can I change the color parameter for entities (all the same in this case) in the card style as opposed to the entity style?.
I am trying to change the icon colour for the media player using the mushroom theme using card mod. I have this working with my lights and plug sockets but cannot get it working with my media players.