position:fixed in reveal.js

前端 未结 2 2050
心在旅途
心在旅途 2021-02-12 23:46

I am trying to make a header for my reveal.js presentation that sticks to the top of the screen. The content in the header is dynamic on a per-slide basis, so I have to place th

相关标签:
2条回答
  • 2021-02-13 00:12

    Add this to css:

    .reveal.slide .slides > section, .reveal.slide .slides > section > section {
      min-height: 100% !important;
      display: flex !important;
      flex-direction: column !important;
      justify-content: center !important;
      position: absolute !important;
      top: 0 !important;
      align-items: center !important;
    }
    section > h1, section > h2 {
      position: absolute !important;
      top: 0 !important;
      margin-left: auto !important;
      margin-right: auto !important;
      left: 0 !important;
      right: 0 !important;
      text-align: center !important;
    }
    .print-pdf .reveal.slide .slides > section, .print-pdf .reveal.slide .slides > section > section {
      min-height: 770px !important;
      position: relative !important;
    }
    
    • Demo https://rawgit.com/rofrol/reveal.js/fixed_header/
    • Code https://github.com/rofrol/reveal.js/blob/fixed_header/index.html#L411
    • Discussion https://github.com/hakimel/reveal.js/issues/1312 https://github.com/hakimel/reveal.js/issues/180
    0 讨论(0)
  • 2021-02-13 00:26

    At the end of your main.html add:

    Reveal.initialize({ center: false, })

    0 讨论(0)
提交回复
热议问题