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

如何调整FullCalendar时间轴小时线尺寸,区分小时线与其他线条

问题描述

这是我的FullCalendar日历:
我的FullCalendar日历

我希望将时间轴中的小时线调整得更粗,如下方示例日历所示:
目标效果日历

需要让用户能够清晰区分小时线与其他线条。

我尝试了以下CSS代码,但它会将所有线条都调整得更粗:

.fc .fc-timegrid-slot {
     height: 18px;
     border-bottom: solid;
 } 

效果如下:
错误效果

解决方案

你之前的CSS选中了所有时间槽线条,所以全部变粗了。要只加粗整小时的分隔线,只需针对FullCalendar里标记为主要时间槽的元素设置样式:

/* 加粗整小时的分隔线 */
.fc .fc-timegrid-slot.fc-slot-major {
  border-bottom: 2px solid #000; /* 可根据需求调整粗细和颜色 */
}

/* 可选:调整次要时间槽(如半小时、15分钟)的线条样式,保持细线条 */
.fc .fc-timegrid-slot.fc-slot-minor {
  border-bottom: 1px solid #ddd;
}

这样就能让整小时的线条明显粗于其他刻度线,和你示例中的效果一致。

内容的提问来源于stack exchange,提问作者baccouche Mohamed khalil

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 19:39:55