Html 在RStudio中居中放置iSlides幻灯片的标题
我正在RStudio中使用一个新的Rmarkdown文件进行快速演示,并使用Html 在RStudio中居中放置iSlides幻灯片的标题,html,css,r,r-markdown,ioslides,Html,Css,R,R Markdown,Ioslides,我正在RStudio中使用一个新的Rmarkdown文件进行快速演示,并使用ioslides将其设置为输出一个HTML文件。以下是我得到的: --- title: "SX MWE Presentation" author: "John Doe" date: "Today" output: ioslides_presentation: smaller: yes widescreen: yes transition: "faster" --- ## Plan Her
ioslides
将其设置为输出一个HTML文件。以下是我得到的:
---
title: "SX MWE Presentation"
author: "John Doe"
date: "Today"
output:
ioslides_presentation:
smaller: yes
widescreen: yes
transition: "faster"
---
## Plan
Here's the plan: I'm going to give one speech today and another next Monday.
## Today's Speech
## Today I'll be talking about A B and C.
## Next Monday
## Next Monday I'll be talking about X Y and Z.
我的问题是:我想让##今天的演讲
和##下周一
幻灯片的标题文本水平和垂直居中。我该怎么做?你会立即看到,这些只是没有内容的幻灯片,只是一个标题,但这是有意的:我只想看几张“设置”幻灯片来确定我们的位置
我的怀疑是,要将这些幻灯片标题放在幻灯片的中心位置,我需要某种自定义css文件,但我一直找不到我想寻找的代码。(当然,我在ioslides文档中查找了答案,但没有找到答案。)您可以尝试以下方法: 在YAML标题后,添加以下行:
<style type="text/css">
h2 {
text-align: center;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
</style>
氢{
文本对齐:居中;
位置:固定;
最高:50%;
左:50%;
转换:翻译(-50%,-50%);
}
}
这意味着您将覆盖header 2 CSS样式。
现在你的标题出现在屏幕的中间,你可以用CSS完全修改你的标题样式,例如改变颜色,字体大小……/P>这很好,所以我非常感谢你!在我的帖子和你的帖子之间,我偶然发现了谢一辉在R中的
Xaringan
演示风格,它比ioslides
看起来更加美观。将来我可能会默认使用Xaringan
,但我认为您的答案对其他像我这样的ioslides用户来说很有价值。再次感谢!