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

Rstudio 0.98.1028 add background image only to title slide

我正在尝试使用 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%;
    }

我能够关闭标题幻灯片上的默认配色方案并将颜色设为黑色:

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

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



}

为了让 foo1.png 进入标题幻灯片,我看到的其他帖子 (Adding an image to title slide using slidify) 建议将其添加到 css:

.title-slide {
     background-image: url(foo1.png);
   }

不插入foo1.png。但是,foo.png 保留在所有幻灯片(包括标题幻灯片)上。如何在我的标题幻灯片上显示 foo1.png?

你已经完成了 99%。只需再进行一两次调整,您就会拥有它。您可以考虑添加以下内容以确保您的幻灯片使用单独的 css 文件,并在您的标题幻灯片中添加类似以下内容。

Intro
======
author: Clever Name
css: css-file.css

然后您可以通过在介绍幻灯片之前的 .Rpres 文件顶部的 <style> </style> 标记之间或单独的 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>

你真的很接近。只需将 title-slide { /* do stuff */ } 更改为 .section .reveal .state-background { /* do stuff */ }