我想在渲染为HTML的句子中给一个单词上色。在R Markdown中,只需添加CSS标签即可完成此操作,但我不知道如何在quarto中实现这一点。 quarto文档 指出可以编写内联CSS,但没有示例。有一个超链接显示了一个R Markdown示例:
```{css, echo=FALSE}
body {
color: red;
}
```
当我这样做时,quarto将代码显示为代码块,并且不使用CSS。
如何在quarto文档中添加CSS代码块?
只需用[]
将您想要样式化的单词括起来,并在{}
中编写样式,就像这样。
the color is [red]{style="color: red;"}
所以单词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"}.
渲染后,我们得到了这个: