Rstudio 0.98.1028仅将背景图像添加到标题幻灯片

Jam*_*ant 5 css r rstudio r-markdown

我试图使用RStudio 0.98.1028创建R演示文稿(.Rpres),标题幻灯片上有不同的背景图像,其余幻灯片上有另一个背景图像.我可以通过在其中创建一个css文件来放置自定义背景(foo.png):

    body {
      background-image: url(foo.png);
      background-position: center center;
      background-attachment: fixed;
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
Run Code Online (Sandbox Code Playgroud)

我能够关闭标题幻灯片上的默认颜色方案,并使用以下颜色将颜色设置为黑色:

.section .reveal .state-background {
    background: transparent;}

.section .reveal h1,
.section .reveal p {
    color: black;



}
Run Code Online (Sandbox Code Playgroud)

要将foo1.png导入标题幻灯片,其他帖子(使用slidify将图像添加到标题幻灯片)我看到建议将此添加到css:

.title-slide {
     background-image: url(foo1.png);
   }
Run Code Online (Sandbox Code Playgroud)

哪个不插入foo1.png.但是,foo.png会保留在所有幻灯片上(包括标题幻灯片).如何在标题幻灯片上获取foo1.png?

Dan*_*son 6

你99%的路在那里.只需要一两个调整就可以了.您可以考虑添加以下内容以确保幻灯片使用单独的css文件,并在标题幻灯片中添加以下内容.

Intro
======
author: Clever Name
css: css-file.css
Run Code Online (Sandbox Code Playgroud)

然后,您可以通过<style> </style>在介绍幻灯片之前的.Rpres文件顶部或单独的css文件中的标记之间包含以下内容来覆盖标题幻灯片的背景.

<style>
/* Your other css */

.section .reveal .state-background {
    background: url(foo1.png);
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}
</style>
Run Code Online (Sandbox Code Playgroud)

你真的很亲密 只需改变你title-slide { /* do stuff */ }.section .reveal .state-background { /* do stuff */ }