【问题标题】:Changing the background color from blockquote to blockquote in rmarkdown在 rmarkdown 中将背景颜色从 blockquote 更改为 blockquote
【发布时间】:2022-01-12 01:02:18
【问题描述】:

获取以下rmarkdown 文件。我想让每个blockquote 呈现不同的背景颜色(第一个是黄色,第二个是白色),但第二个css 块似乎中和了第一个。

有人可以帮帮我吗?

---
title: "Untitled"
output: html_document
---


```{css echo = FALSE}
blockquote{
background-color: rgb(255,255,153);
}
```

> this is a note 1
>
> the is is still the note


```{css echo = FALSE}
blockquote{
background-color: initial;
}
```

> this is a note 2
>
> the is is still the note

【问题讨论】:

    标签: css r r-markdown


    【解决方案1】:

    试试这个解决方案:

    <div style="background-color:rgba(250, 230, 7, 1);">
    
    > this is a note 1
    >
    > the is is still the note
    
    </div>
    
    
    <div style="background-color:rgba(63, 237, 40, 1);">
    
    > this is a note 2
    >
    > the is is still the note
    
    </div>
    

    【讨论】:

    • 谢谢,@manro!您的解决方案有效!但是您知道为什么我的方法不起作用吗?
    • @PaulSmith 是的,我知道。我现在添加一个解释。
    • 谢谢@manro!
    • @PaulSmith 根据我的非专业意见,您应该通过# 为每个blockquote 设置样式。 F.e. :&lt;style&gt; blockquote {...something} #bl1 {...something} ... #blN{...something} &lt;/style&gt;
    • @PaulSmith 祝你以后工作顺利,现在我可以去睡觉了。再见;)
    猜你喜欢
    • 2017-04-23
    • 2015-05-16
    • 1970-01-01
    • 2020-04-03
    • 1970-01-01
    • 2014-01-19
    • 1970-01-01
    • 2017-12-16
    • 2019-02-11
    相关资源
    最近更新 更多