You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改Bootstrap-Vue卡片(b-card)头部的尺寸?

如何修改我的卡片头部的尺寸?

你现在的问题是给整个b-card加了style,导致所有文本都继承了字体大小,要单独设置头部样式,有几种简单方法:

方法1:用header-class自定义样式

先给卡片头部指定一个自定义类,再通过CSS单独设置:

<b-card header="We are certified data installers" 
        md="5" 
        class="card" 
        bg-variant="dark" 
        header-class="custom-card-header"
        style="border-color: rgb(235, 100, 33);">
    
    We are skilled in getting you set up or helping when you need changes made, as your business changes or expands.

</b-card>

然后在样式文件里写:

.custom-card-header {
  font-size: 30px; /* 你需要的字体大小 */
  padding: 1.2rem; /* 调整头部内边距改变整体尺寸 */
  /* 还可以添加height、line-height等属性控制头部高度 */
}

方法2:用header-style直接写内联样式

如果不想额外写CSS类,直接给头部加内联样式:

<b-card header="We are certified data installers" 
        md="5" 
        class="card" 
        bg-variant="dark" 
        header-style="font-size: 30px; padding: 1.2rem;"
        style="border-color: rgb(235, 100, 33);">
    
    We are skilled in getting you set up or helping when you need changes made, as your business changes or expands.

</b-card>

方法3:用Bootstrap内置类

如果使用Bootstrap的默认样式体系,可以直接把字体、间距类加到header-class里,比如用fs-3对应字体大小(Bootstrap的fs-1到fs-6是预设字体尺寸类):

<b-card header="We are certified data installers" 
        md="5" 
        class="card" 
        bg-variant="dark" 
        header-class="fs-3 py-2"
        style="border-color: rgb(235, 100, 33);">
    
    We are skilled in getting you set up or helping when you need changes made, as your business changes or expands.

</b-card>

核心逻辑是别把样式加在整个b-card标签上,而是用Bootstrap Vue提供的header-class或header-style属性,专门作用于卡片头部区域。

内容的提问来源于stack exchange,提问作者Jerry

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 14:55:20