← 主题样式

让编辑器中的标题显示不同的字号

# 自定义CSS
工作人员
2026/08/24 10:16

WonderPen 当前的版本中,页内标题默认字号和正文一样大,只在左边有 H1、H2 这样的标识,如下图所示:

如果你喜欢不同级别的标题使用不同的字号显示,可以使用自定义 CSS 来实现,代码如下:

[data-role="editor"] .ProseMirror {
  h1 {
    font-size: 2.5em;
    line-height: 2.5em;
  }

  h2 {
    font-size: 2.2em;
    line-height: 2.2em;
  }

  h3 {
    font-size: 2em;
    line-height: 2em;
  }

  h4 {
    font-size: 1.6em;
    line-height: 1.6em;
  }

  h5 {
    font-size: 1.4em;
    line-height: 1.4em;
  }

  h6 {
    font-size: 1.2em;
    line-height: 1.2em;
  }

  h1, h2, h3, h4, h5, h6 {
    background: none !important;

    &:before {
      content: "";
    }
  }
}

效果如下:

0 条回复

还没有回复

来抢沙发吧。

回复

请先 登录 后回复。