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

同CSS过渡规则下,Bulma暗黑模式中部分元素过渡为何更慢?

Bulma暗黑模式过渡异常问题

我正在为Bulma框架制作暗黑模式样式表,通过替换SCSS变量并重新编译所有组件实现,核心SCSS代码结构如下:

/* entry.scss */

.is-light-mode {
  @import default-variables.scss;
  @import component-1.scss;
  @import component-2.scss;
  @import component-3.scss;
  ...
}

.is-dark-mode {
  @import dark-mode-variables.scss;
  @import component-1.scss;
  @import component-2.scss;
  @import component-3.scss;
  ...
}

* {
  transition:
    color .4s,
    background-color .4s,
    border-color .4s;
}

其中default-variables.scss和dark-mode-variables.scss是明暗模式的初始变量与派生变量占位文件。我的思路是将明暗模式整合到单个CSS文件中,通过全局通配符*规则为所有元素的color、background-color、border-color设置0.4s过渡效果。

该方案大体可行,但发现.content元素的文本过渡速度明显慢于其他元素。切换暗黑模式时,内容下方的“post date”文本颜色过渡比其他元素慢,内容文本的过渡问题更严重;但取消注释CSS中第20-22行后,内容过渡恢复正常。此外,该问题在Firefox中不存在。

请问为何这些特定元素的过渡速度更慢?


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.13 05:25:39