{"id":304383,"date":"2020-03-05T08:27:44","date_gmt":"2020-03-05T15:27:44","guid":{"rendered":"https:\/\/css-tricks.com\/?p=304383"},"modified":"2020-03-06T11:38:28","modified_gmt":"2020-03-06T18:38:28","slug":"the-slideout-footer","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/the-slideout-footer\/","title":{"rendered":"The Slideout Footer"},"content":{"rendered":"\n

A fascinating new site called The Markup<\/a> just launched<\/a>. Tagline: Big Tech Is Watching You. We\u2019re Watching Big Tech. <\/em>Great work from Upstatement<\/a>. The content looks amazing, but of course, around here we’re always interested in the design and tech as well. There is loads to adore, from the clean typography, interesting layout, and bold angled hover states on blocks, to the tasteful dots motif.<\/p>\n\n\n\n

The footer is clever as well, in how it appears to slide out from underneath the content as you scroll to the bottom of the page. Let’s make it!<\/p>\n\n\n\n\n\n\n\n

  1. The main content area is at least 100vh<\/code> tall<\/strong>. Most sites are anyway, but just to be safe. <\/li>
  2. The main content area has a solid background<\/strong> as well, which covers the footer we’re going to hide behind it. <\/li>
  3. The footer comes after the main content area in the HTML, so to make sure the main content area sits on top<\/strong>, you’ll need a little relative positioning and z-index.<\/li>
  4. The footer uses sticky positioning<\/strong> to place itself on the bottom. <\/li><\/ol>\n\n\n\n

    That last one is the fanciest trick, and it’s actually fancier than The Markup does it. They use position: fixed;<\/code> on the footer and a magic number<\/a> margin-bottom<\/code> on the main content to make it work. No magic numbers needed when going sticky.<\/p>\n\n\n\n