reveal.js title slide override

那年仲夏 提交于 2019-12-02 11:34:37

问题


I would like to style my reveal.js very first (title) slide slightly differently than my other slides. How could I create a separate section environment for "title" slides with:

  1. All headings and text centered?
  2. All contents vertically aligned in the middle?

My default (content) slides should be left-aligned and not vertically centered. This means that in the init part Reveal.initialize({... center: false, ...})

And for my custom theme.css, all headings and paragraph text are left-aligned with text-align: left.

I was hoping there would be some <section data-center=true> override option, but there does not seem to be. I have been fiddling with div's, but I am no great HTML/CSS guru.

As a follow up question, could this be automatically triggered if <h1> is used on a slide? That would allow me to use external Markdown for the contents and nothing else.


回答1:


Just use a class to namespace your title slide

<section class="title-slide">
    <h1>Title</h1>
</section>

and style it with a higher specificity than the other slides

h1 {
    text-align: left;
}

.title-slide h1 {
    text-align: center;
}

This should address your second question as well without having to trigger anything dynamically.



来源:https://stackoverflow.com/questions/40345094/reveal-js-title-slide-override

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!