『瀚思彼岸』» 智能家居技术论坛

标题: 求教 关于蘑菇卡片图片大小调整的问题 [打印本页]

作者: uu7711    时间: 2025-7-22 00:07
标题: 求教 关于蘑菇卡片图片大小调整的问题
  1. type: custom:mushroom-template-card
  2. entity: fan.zhimi_cn_271052863_va1_s_2_air_purifier
  3. secondary: ""
  4. picture: |-
  5.   {% set status = state_attr(entity,'preset_mode') %}
  6.   {%
  7.     if status == "最爱" and is_state(entity, 'on')  %}
  8.     /local/home/icon/red_fan.gif {% elif status == "自动" and is_state(entity, 'on') %}
  9.     /local/home/icon/fan.gif {% elif status == "睡眠" and is_state(entity, 'on')  %}
  10.     /local/home/icon/night_fan.gif {% else %} /local/home/icon/fan_off.png {% endif %}
  11. primary: ""
  12. style:
  13.   top: 21%
  14.   left: 32.5%

  15. card_mod:
  16.   style: |
  17.     ha-card {
  18.       background: transparent !important;
  19.       border: 0px solid #333333 !important;
  20.       padding:0px !important;
  21.     }
  22.     ha-card img{
  23.       width: 10px !important;  
  24.       height: 10px !important;
  25.       object-fit: contain !important;
  26.     }
复制代码
请问下各位大佬 上面代码中图片的大小怎么通过ha-card来控制? 蘑菇卡片css选择器是怎么确定的?

作者: relliky    时间: 2025-7-22 00:33
本帖最后由 relliky 于 2025-7-22 00:34 编辑

关于CSS, 在游览器里按F12,一点点的找到CSS代码,直接修改就可以看到效果了。如果确认了效果,再把要改的代码放回yaml就好。

我之前花了一个下午和晚上,写了个灯光的卡片。https://bbs.hassbian.com/thread-22726-1-1.html

作者: uu7711    时间: 2025-7-22 12:38
relliky 发表于 2025-7-22 00:33
关于CSS, 在游览器里按F12,一点点的找到CSS代码,直接修改就可以看到效果了。如果确认了效果,再把要改的 ...

感谢 已解决




欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) Powered by Discuz! X3.5