对于可重现的示例,我使用的是R studio自带的默认Ioslides演示。新建File>R markdown>幻灯片演示。数据是安装R Studio时附带的mtcars数据集。看幻灯片2 (R Markdown),我希望边际是现在的一半。然而,没有找到成功。对如何做到这一点有什么想法吗?
我的YAML是这样的
title: "margin example"
author: "Tim"
date: "2/2/2021"
output:
ioslides_presentation:
css: styles.css
接下来是我要使用的CSS
h2{
font-family:'Arial';
font-size:22px !important;
padding-bottom:1px;
margin:1px;
margin-bottom:1px;
}
p {
font-size: 18px;
margin:1px;
margin-bottom:0px;
margin-top:0px;
}
为你的CSS添加一个新类
.reduceTopMarginText p:first-of-type {
margin-top: -25px
}
并将其分配给幻灯片
## Titel {.reduceTopMarginText}
Text closer to your title.
如果幻灯片上的第一个元素不是文本而是代码,则将CSS中的p
替换为pre
。