下面是一些CSS樣式,你可以用它來完成你所需要的。
- 降價文檔標題使用
h1.title
CSS選擇器
- 降價文檔作者字段使用
h4.author
CSS選擇器
- 降價文件datea字段使用
h4.date
CSS選擇器
這裏是代碼:
---
title: "Shiny HTML Doc"
author: "theforestecologist"
date: "Apr 14, 2017"
output: html_document
runtime: shiny
---
<style type="text/css">
h1.title {
font-size: 38px;
color: DarkRed;
text-align: center;
}
h4.author { /* Header 4 - and the author and data headers use this too */
font-size: 18px;
font-family: "Times New Roman", Times, serif;
color: DarkRed;
text-align: center;
}
h4.date { /* Header 4 - and the author and data headers use this too */
font-size: 18px;
font-family: "Times New Roman", Times, serif;
color: DarkBlue;
text-align: center;
}
</style>
# H1 Header
Some body text
## H2 Header
More body text
```{r echo=T}
n <- 100
df <- data.frame(x=rnorm(n),y=rnorm(n))
```
這是什麼樣子的,然後結束:

你說所產生的標題/作者/時,它的渲染有關日期?這是應用了任何CSS的產品。 – alistaire
@alistaire是的。我無法弄清楚如何去做。由於這個文本是在YAML中,我假設我不能將正常的HTML或CSS代碼應用到YAML中? – theforestecologist
YAML作爲參數通過'render'傳遞給提供的輸出格式('html_document'),這本身就是一個函數。它全部被渲染爲降價(包括標題/等),pandoc將其轉換爲HTML。如果提供了外部CSS樣式表,它實際上不會在瀏覽器呈現它之前應用。因此,改變標題外觀的最簡單方法就是爲外部樣式表提供特定於要更改的元素的選擇器。 – alistaire