Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add sticky footer to Polymer Starter Kit with Iron Pages

I'm trying to add a sticky footer to the Polymer Starter Kit. So far I've tried

core-header-panel and sticky footer and http://www.jlmiller.guru/jekyll/2015/06/02/sticky-footer.html

but neither seem to work.

How do you add/style a sticky footer to a paper-header-panel?

<paper-header-panel class="flex">
  <paper-toolbar>
    <div>Paper-Toolbar</div>
  </paper-toolbar>
  <div class="content fix fullbleed layout vertical">
    <iron-pages attr-for-selected="data-route" id="pages" selected="home">
      <section data-route="home" class="layout vertical center">
        <paper-material>This is some content for home
          <br />
          <br />
          <br />
          <br />
        </paper-material>
        <paper-material>This is some other content for home</paper-material>
        <paper-button id="btn1" raised>Next Iron Page</paper-button>
      </section>
      <section data-route="page1" class="layout vertical center">
        <paper-material>This is content for Page 1</paper-material>
        <paper-button raised>Button to move to Home</paper-button>
      </section>
    </iron-pages>
  </div>
  <!-- content -->
  <footer>
    Sticky footer?
  </footer>
</paper-header-panel>

Plunker http://plnkr.co/edit/wOxCgExdWdJdhhfQ4xBz?p=preview

like image 749
Danprime Avatar asked Aug 23 '15 00:08

Danprime


People also ask

How do I make the footer stick to the bottom of the page?

To do this just remove margin top from footer and set margin top and bottom to auto margin: auto 0; on your main content (in my case article element) or margin: auto; to center it on both direction (vertically and horizontally) and it will make content align to center.

How do I stick footer to the bottom when page content is less?

Quick answer: Add “display:flex; flex-direction:column; min-height:100vh;” to body or appropriate layout body element, then add “flex:1;” to content wrapper element/section.

How do I make a sticky footer in bootstrap 4?

Make Footer Sticky To make your footer stick to the bottom of the viewport, add classes d-flex , flex-column , and h-100 to the body tag. Also add class h-100 to <html> tag.


1 Answers

One way is to use position:fixed.

  <footer style="position:fixed;bottom:0">
    Sticky footer?
  </footer>

Or you can move the footer outside of the paper-header-panel and wrap both of them in a vertically stacked div.

<div class="fit vertical layout">
  <paper-header-panel class="flex">
  ...
  </paper-header-panel>

  <footer>
    Sticky footer?
  </footer>
</div>

Note that on the root div I have used fit to make its content fill the entire page and vertical layout to stack the content vertically.

See this plunker.

like image 162
Justin XL Avatar answered Oct 21 '22 06:10

Justin XL