Antd - 有没有改变卡片标题的背景颜色? [英] Antd - is there anyway to change background color of the Card title?

查看:29
本文介绍了Antd - 有没有改变卡片标题的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过添加 style 属性,我只能改变 Card 组件主体部分的颜色.我该如何更改标题部分?

By adding the style attribute I can only change the color of the body part of the Card component. How can I change the title part as well?

<Card title='Card title' bordered loading={this.onLoading()}
    style={{ backgroundColor: '#aaaaaa' }}>
    <Row type='flex' justify='center'>
    <h1>Card content</h1>
    </Row>
</Card>

推荐答案

以下对我有用.我必须删除整个卡片的背景颜色,并为 Head 和 Body 内容设置不同的背景颜色:

The following worked for me. I had to remove the background color of the entire card and set a different background color both for the Head and Body content:

<Card
title="Track title"
style={{backgroundColor: 'rgba(255, 255, 255, 0.0)', border: 0 }}
headStyle={{backgroundColor: 'rgba(255, 255, 255, 0.4)', border: 0 }}
bodyStyle={{backgroundColor: 'rgba(255, 0, 0, 0.4)', border: 0 }}
>
    <Card.Meta
    description="Track author"
    />
</Card>

结果:

希望有帮助!

这篇关于Antd - 有没有改变卡片标题的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆