【问题标题】:Formatting h1, h2 in rmd/rmarkdown在 rmd/rmarkdown 中格式化 h1、h2
【发布时间】:2016-07-09 19:12:47
【问题描述】:

使用外部 css 文件,我可以更改 Rmd/html 文档中的许多项目,但一些基本的项目被 markdown (?) 插入的内联 css 覆盖。

.main-container {
....
h1 {
  font-size: 34px;
}
h2 {
  font-size: 30px;
}

所以改变h2字体大小的唯一方法是直接将代码插入到文档中,这很难看:

---
output: 
  html_document:
    theme: cosmo
   # css: whatever.css # adding h2 here does not work
---

<style type = "text/css">
h2 {color: red;}
</style>

## R Markdown

有更好的解决方案吗?是否可以抑制上述内联块?

【问题讨论】:

  • 你可以在你的自定义css中使用!important来覆盖
  • 不推荐使用!important,但是,在CSS中你不能有比内联样式AFAIK更高的特异性......你必须剥离内联样式或在@中使用!important 987654321@:element[style] { property: value !important; }
  • 我试过h2[style] { color: blue !important; }没有效果。是不是语法错了?
  • @DieterMenne 我们应该聊聊。

标签: css r r-markdown


【解决方案1】:

【讨论】:

    猜你喜欢
    • 2016-01-14
    • 1970-01-01
    • 2015-07-20
    • 1970-01-01
    • 2020-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    相关资源
    最近更新 更多