我想为以四开本呈现为 HTML 的句子中的单词着色。在 R Markdown 中,我只需添加一个 css 标签,但我不知道如何在四开本中执行此操作。quarto文档说可以编写内联 css,但没有示例。有一个超链接显示了 R Markdown 示例:
```{css, echo=FALSE}
body {
color: red;
}
```
Run Code Online (Sandbox Code Playgroud)
当我这样做时,四开将代码显示为代码块并且不使用 CSS。
如何将 CSS 代码块添加到四开文档?
sha*_*fee 17
只需围绕您想要设置样式的单词[]并在其中写入样式{},就像这样
the color is [red]{style="color: red;"}
Run Code Online (Sandbox Code Playgroud)
所以这个词的red颜色是红色的。
要添加更多详细信息,
---
title: "inline style"
format: html
---
## inline style in Quarto
We can apply styles to a sentence or a word
by creating spans using `[]` to surround the
sentence or word that we want to style and
use `{}` to define the style that we want to
apply. For example,
The color of this word is [red]{style="color: red;"}.
And [this line has a yellow background]{style="background-color: yellow"}.
Run Code Online (Sandbox Code Playgroud)
渲染后,我们得到这个,