找回密码
 立即注册
查看: 159|回复: 2

[已解决] 请问Button card里怎么可以把几个卡片垂直平均排列

[复制链接]

4

主题

11

回帖

154

积分

注册会员

积分
154
金钱
139
HASS币
0
发表于 2025-5-30 16:49:26 | 显示全部楼层 |阅读模式
本帖最后由 stone360 于 2025-6-5 17:16 编辑

如图,3个卡片分别是bar1,bar2,bar3,但是我们怎么调整,他们之间的行距都没有变化,请大神帮我看看代码应该怎么调整?

1.jpg

          - type: custom:button-card
            show_icon: false
            show_name: false
            show_state: false
            show_label: false
            name: 信息统计菜单栏
            style:
              top: 10%
              left: 27%
            styles:
              grid:
                - grid-template-areas: |
                    "bar1"
                    "bar2"
                    "bar3"
                - grid-template-columns: 5px
                - grid-templat-rows: 40px 40px 40px
              card:
                - width: 80px
                - height: 150px
                - background-color: transparent
            custom_fields:
              bar1:
                card:
                  type: custom:button-card
                  entity: sensor.all_lights_num
                  layout: icon_name
                  show_icon: true
                  show_name: false
                  show_state: true
                  icon: mdi:lightbulb-group
                  name: 开灯数量
                  styles:
                    icon:
                      - margin-top: ‘0px'
                      - margin-left: '0px'
                      - width: '50px'
                      - color: white
                    state:
                      - margin-top: '-23px'
                      - margin-left: 15px
                      - font-size: 15px
                    card:
                      - background-color: rgba(0,0,0,0.3)
                      - width: 80px
                      - height: 40px
                      - border-radius: 40px
              bar2:
                card:
                  type: custom:button-card
                  entity: sensor.all_fans_num
                  layout: icon_name
                  show_icon: true
                  show_name: false
                  show_state: true
                  icon: mdi:fan
                  name: 风扇数量
                  styles:
                    icon:
                      - margin-top: ‘0px'
                      - margin-left: '0px'
                      - width: '50px'
                      - color: white
                    state:
                      - margin-top: '-23px'
                      - margin-left: 15px
                      - font-size: 15px
                    card:
                      - background-color: rgba(0,0,0,0.3)
                      - width: 80px
                      - height: 40px
                      - border-radius: 40px
              bar3:
                card:
                  type: custom:button-card
                  entity: sensor.all_climate_num
                  layout: icon_name
                  show_icon: true
                  show_name: false
                  show_state: true
                  icon: mdi:air-conditioner
                  name: 空调数量

                  styles:
                    icon:
                      - margin-top: ‘0px'
                      - margin-left: '0px'
                      - width: '50px'
                      - color: white
                    state:
                      - margin-top: '-23px'
                      - margin-left: 15px
                      - font-size: 15px
                    card:
                      - background-color: rgba(0,0,0,0.3)
                      - width: 80px
                      - height: 40px
                      - border-radius: 40px


回复

使用道具 举报

10

主题

208

回帖

1920

积分

金牌会员

积分
1920
金钱
1697
HASS币
20
发表于 2025-5-30 19:36:20 | 显示全部楼层
本帖最后由 hungheo 于 2025-5-30 19:38 编辑

- grid-template-rows: 40px 40px 40px
楼主的代码这一行template少了一个e
回复

使用道具 举报

4

主题

11

回帖

154

积分

注册会员

积分
154
金钱
139
HASS币
0
 楼主| 发表于 2025-5-30 20:46:28 | 显示全部楼层
hungheo 发表于 2025-5-30 19:36
- grid-template-rows: 40px 40px 40px
楼主的代码这一行template少了一个e

非常感谢,终于发现问题了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-6-16 15:55 , Processed in 1.296182 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表