css - 标题选择器不响应 Rmarkdown html 报告的 css 中的字体大小规则

标签 css yaml r-markdown

我的标题“Utilize Css”的字体大小似乎对保存在同一目录中的 css 样式表中的 font-size 参数没有反应。我已经试验了此 css 样式表中的所有其他参数,它们都按预期更新了报告,但标题选择器的字体大小参数对报告中的标题没有影响。

我正在使用这样的 YAML header

---
title: "Utilize Css"
author: "Me"
date: "2019-07-15"
output:
  html_document:
    css: style.css
---

像这样的样式表

.title {
  font-size: 14px;
  text-align: center;
}

.author, .date {
  font-size: 14px;
  text-align: center;
}

body {
  font-family: Arial;
  font-size: 12pt;
}

h1 {
  font-size: 14pt;
  font-weight: bold
}

如您所见,除标题的字体大小外,所有字体大小均由 css 样式表设置。 screenshot

如何使用 css 样式表来控制 html 报告中标题的字体大小?

最佳答案

您应该能够在 style.css 文件中使用 h1.title 来控制标题大小。

h1.title {
  font-size: 14px;
  text-align: center;
}

.author, .date {
  font-size: 14px;
  text-align: center;
}

body {
  font-family: Arial;
  font-size: 12pt;
}

h1 {
  font-size: 14pt;
  font-weight: bold
}

关于css - 标题选择器不响应 Rmarkdown html 报告的 css 中的字体大小规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57046468/

相关文章:

doctrine-orm - Doctrine ORM - 如何映射 jsonb/yaml?

r - 修改简历包R生成的CV

html - CSS 消息 ul li span 在 x 而不是 y 上溢出

javascript - 使用 jQuery 更改父元素样式

python - 执行从 python gflags 到 yaml 和返回的转换的惯用方式是什么?

r - 使用 Rmarkdown 和 Shiny 获取交互式文档中数据表中的选定行

r - 在 R Markdown 中嵌入 Youtube 视频

html - 如何在 css 中使用 clip-path 属性作为边框

javascript - 将高度设置为零后,CSS 转换失败

javascript - 在 JS 中仅从文件中获取 YAML 文本