【问题标题】:Change background color outside of the body in Rmarkdown在 Rmarkdown 中更改正文外部的背景颜色
【发布时间】:2021-06-10 03:12:44
【问题描述】:

我希望更改 Rmarkdown 中绘制区域的颜色,但我似乎无法找到仅针对它的 div。如果我将它应用到身体上,一切都会改变颜色

【问题讨论】:

    标签: css r r-markdown


    【解决方案1】:

    您可以使用内联 CSS 或 CSS 块。

    ---
    title: "TEST"
    output: 
      html_document:
        toc: true
        toc_float: true
        toc_collapsed: true
        toc_depth: 3
        number_sections: true
    theme: lumen
    ---
    
    ```{css echo = FALSE}
    body{
    background-color: black;
    }
    ```
    
    
    # cardiology
    # cardiology
    # cardiology
    # cardiology
    # cardiology
    
    This is a paragraph. This is a paragraph. 
    This is a paragraph. This is a paragraph. This is a paragraph. This     is a paragraph. This is a paragraph. This is a paragraph. This is a     paragraph. This is a paragraph.
    

    【讨论】:

      【解决方案2】:

      在css中,可以将.body指定为外部部分的背景色,而在.toc-content类内部改变背景色,内部会变为想要的

      .toc-content{
        background-color: rgb(255, 255, 255) !important;
      }
      body{
        background-color: black;
      }
      

      【讨论】:

        猜你喜欢
        • 2017-04-23
        • 2015-05-16
        • 1970-01-01
        • 2022-01-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-24
        • 2012-02-29
        相关资源
        最近更新 更多