xaringan - 我可以使用 css 为 xaringan 模板的每张幻灯片添加徽标吗?
问题描述
我想调整此处提供的 .css 文件,以便在每张幻灯片的右上角包含一个小徽标,但标题、反面和最后一张幻灯片除外。理想情况下,我可以在 .css 文件中添加一些简单的内容,而不是手动编写演示文稿的每张幻灯片。
我试着添加这个
background-image: url(https://github.com/jvcasillas/ru_xaringan/raw/master/img/logo/ru_shield.png);
background-position: 9% 15%;
background-size: 55px;
至
.remark-slide-content {
padding-left: 100px; /* delete this for 4:3 aspect ratio */
}
要得到
.remark-slide-content {
background-image: url(https://github.com/jvcasillas/ru_xaringan/raw/master/img/logo/ru_shield.png);
background-position: 9% 15%;
background-size: 55px;
padding-left: 100px; /* delete this for 4:3 aspect ratio */
}
图像显示在所有幻灯片上,包括标题和过渡。它甚至覆盖了 .title-slide 图像。
解决方案
您可以执行以下操作来排除title-slide
:
.remark-slide-content:not(.title-slide){
background-image: url(https://github.com/jvcasillas/ru_xaringan/raw/master/img/logo/ru_shield.png);
background-position: 9% 15%;
background-size: 55px;
padding-left: 100px; /* delete this for 4:3 aspect ratio */
}
但这样做的缺点是,如果您在其他幻灯片中有背景图像,它将覆盖上面的图像。因此,您可能还想定义另一个类,例如exclude
:
.remark-slide-content:not(.exclude){
background-image: url(https://github.com/jvcasillas/ru_xaringan/raw/master/img/logo/ru_shield.png);
background-position: 9% 15%;
background-size: 55px;
padding-left: 100px; /* delete this for 4:3 aspect ratio */
}
.logopos {
position: absolute;
top: 9%;
left: 15%;
}
对于您对另一个背景图像有问题的相应幻灯片,请禁用它并手动添加它。例如
class: exclude
background-image: url("bla")
content
<img class="logopos" src="https://github.com/jvcasillas/ru_xaringan/raw/master/img/logo/ru_shield.png">
推荐阅读
- python - 我在哪里为 Qt 设计器的单个提升 QWidget 编写类
- python - F0321 01:22:08.021044 18633 math_functions.cpp:250] 检查失败:a <= b (0 vs. -1.19209e-07)
- typescript - 从扩展 Typegoose 并包含静态类型特定方法的父类继承
- amazon-web-services - 重新创建 EMR 集群后保持 HDFS 状态
- javascript - AngularJS ng-repeat 不适用于选择选项
- r - 如何确定向量中有多少元素包含来自第二个向量的模式?
- javascript - 使用 Javascript 拦截开发服务器上的链接
- sql-server - SQL server JDBC:存储过程OUTPUT十进制参数返回错误值
- .htaccess - 使用 htaccess 更改文档根目录
- c++ - 是否可以将另一个类的函数实现为单独的类函数