I wonāt to change icon colour based on status of two sensors.
If one of my windows is open then I want gold colour else colour must be steelblue
Does not work as expected.
Can you please check my code:
Iām trying to use card mod to alter a card layout, and I have the individual elements working, but Iām not sure how the syntax should be to merge the two styles Iām trying to apply.
Could anyone advise what the correct syntax is to add this;
Iām trying to adjust the font size of the āvalueā for https://github.com/custom-cards/dual-gauge-card - if itās been mentioned somewhere I accept the humiliation on failing to find the answer with Google.
Iāve attempted various combinations and tried to use developer view of browser but CSS is all Chinese to me.
What it looks currently:
Current attempt (yeah, I know 40px is not the value I want to use, but trying it for debug purposes to see when I wouldāve managed to change the value).
I am trying to set font size of the ākitchenā part of this card. But i am struggling a bit. The color and background and weight settings work, but not the font size. I am also not sure when to use ha-card vs :host? On a related note, can i set the background color as a rgb code, or take from the time, or does it have to be a ānamed colorā?
This is an example of probably useless styling; consider it as a demo.
āUselessā - because alternative ways may be used; anyway, this is up to a user which way to choose.
Consider some device with 2 attributes.
Each attribute may be expressed by some icon.
Here there is a device with 2 attributes:
battery level - expressed by some ābatteryā icon;
āworking / not workingā - expressed by some āfanā icon.
This example contains 2 Entities cards:
To select a battery level.
To represent this device.
The 2nd Entities card has 2 rows:
For battery level - has a hidden state label.
For āworking/not workingā state.
And both rows are placed in one row.
This is achieved by this styles:
I donāt know enough about car-mod to know when host is right and ha-card is right, but in this case i tried ha-card first and it seems to give the same result. Background, color and font-weight changes how it looks, but font-size seems to make no difference.
Try !important in such cases first. Did you do this? You can see this good in developer tools in Chrome, etc. as well. Just open it and see which styles are applied and which are crossed out, etc. If your set value is crossed out then another one overruling and you can avoid via !important.
And you can set any color you want, not only named.
Thanks. You seem to be right it is crossed out (see picture on the bottom), not sure why though, but what does it mean to try ā!importantā? Do I have to write !important font-size: 80px? And to set an RGB-color how do i do it? Rgb(x,x,x) instead of āredā?
Thanks, Iām sorry I am not that skilled with CSS, I tried googling, that is why i came up with the original solution. As with the testing, it just felt easier to ask about what the right syntax was instead of trying stuff that could just as well not work. Sorry for wasting your time.
Bit thanks a lot for the solution, it now works just like i wanted with the !important-tag and the rgb(x,x,x) syntax.
@ATWindsor let me explain you how it works.
To help you someone in most cases should:
take your code,
paste it into own dashboard,
add necessary sensors, replace your sensors in the code with the added sensors,
see if styles what you need are applied,
try to experiment with different CSS properties, adding ā!importantā, changing DOM navigation.
This is not ā1-second-glanceā. This all takes time.
And this may be done by YOU.
There are a lot of examples here.
Enough to use them by ācopy/pasteā, enough to adapt them to personal needs, enough to self-educate.
I understand it can take time to help, and i appreciate the help. I dont expect people to change out their whole config to help either (I donāt if I answer questions, i certainly understand why people wonāt bother with that).
But while I agree I of course have the ability to educate myself to a high level in the subject if I put in the time, I donāt think it is that unreasonable to ask a question like this, I did go through the examples first, that is why i had the code i had, and tried exchanging ha-card with :host for instance, but In the examples i found no-one used an rgb-code, and the font size didnāt have important in front of it. I also tried things like em, percentage, ālargeā and so on with the font size. I donāt want to sound ungrateful, I am genuinely happy for the help, but I had a problem i wanted to solve, card-mod looked like the tool for the job, sometimes in can cost you quite a considerable amount of time trying to search for a problem that isnāt even necessarily solvable with the tool you chose. (I began with a different integration before but card-mod seems like a better solution).
Learning any new stuff like card-mod is not an easy task.
This all needs a ātry / make an error / repeatā approach.
I myself have never dealt with any web-programming, a āCSSā word I came to know in this thread first.
One thing is here.
When I started learning card-mod, I decided to create test cards with examples to cover different cases. That was a good lesson, a good practice.
A bit later I decided to post these examples in this thread.
All my examples here available in the consolidation post (1st post ā link at the bottom).
Examples for the ābuttonā card are not there - probably because most people are using a more powerful ācustom:button-cardā.
I think I should prepare some examples with the ābuttonā card too.
Yeah, those examples are great, and very helpful, those are the ones i used to get to my first version of the code. postet above. Thanks for putting in the work.
ā¦and you should not use a code for a āxxx-cardā to style a āyyy-cardā.
These cards may have different structure, different CSS properties.
What you can do with some new card is - using Code Inspector, try to use methods which you learned with other cards.
Hello!
I found a lot of good solutions here. I have a problem that I couldnāt figure out. I want to hide this entire column.
I can hide the cards separately by entity status, but I canāt hide the VERTICAL-STACK at the same time.
Please help!