---
title: "My study"
output:
html_document:
df_print: paged
---
我使用下面的代碼來控制整個檔案的文本格式
<style type="text/css">
body{
font-size: 14pt;
font-family: Garamond;
line-height:1.8;
}
</style>
我現在想自定義某些段落或字幕
## SUBTITLE 1 (to color in blue)
.
## SUBTITLE 2 (to color in blue)
.
{ in italic and colored in brown and line-height=1
My paragraph text My paragraph text My paragraph text My paragraph text My paragraph text
My paragraph text My paragraph text My paragraph text My paragraph text My paragraph text
}
uj5u.com熱心網友回復:
2 級標題呈現為h2html 元素。要更改所有這些標題的顏色,您可以執行以下操作,這會將所有標題更改## {insert heading}為藍色字體。
h2 {
color: blue;
}
要更改某些標題的顏色,您可以使用 html 標簽創建它們并給它們一個類。然后在 CSS 中更改類的樣式。
HTML:
<h2 class="purple-heading">Some heading</h2>
CSS:
.purple-heading {
color: purple;
}
要設定某些段落的樣式,請將它們包裝在<p>標簽中并給它們一個類。然后在 CSS 中設定類的樣式。
HTML:
<p class="large-p">A long and very large paragraph.</p>
CSS:
.large-p {
font-size: 96px;
}
整體降價檔案:
---
title: "test"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
<style type="text/css">
body{
font-size: 14pt;
font-family: Garamond;
line-height:1.8;
}
h2 {
color: blue;
}
.purple-heading {
color: purple;
}
.large-p {
font-size: 96px;
}
</style>
## H2
<h2 >Some heading</h2>
some un-styled text
<p >A long and very large paragraph.</p>
如果您要設計的樣式不止一些(也許即使您沒有),我建議將 html/markdown 與 CSS 分開。您可以創建一個 .css 檔案并按如下方式更改 YAML 標頭:
---
title: "test"
output:
html_document:
css: your_path.css
---
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/340008.html
