{"id":273,"date":"2021-01-22T19:26:00","date_gmt":"2021-01-22T19:26:00","guid":{"rendered":"https:\/\/wshop.fi\/eng\/?p=273"},"modified":"2021-03-22T19:27:19","modified_gmt":"2021-03-22T19:27:19","slug":"css-sticky-footer-sticks-whether-youve-scrolled-or-not","status":"publish","type":"post","link":"https:\/\/wshop.fi\/eng\/css-sticky-footer-sticks-whether-youve-scrolled-or-not\/","title":{"rendered":"CSS Sticky Footer &#8211; Sticks Whether You&#8217;ve Scrolled or Not"},"content":{"rendered":"\n<p>There are several tutorials on how to make a&nbsp;<strong>CSS sticky footers<\/strong>&nbsp;sticky header, or sticky sidebar. &nbsp;This is one.<\/p>\n\n\n\n<p>Remember to compensate at the bottom of your page so the CSS sticky footer doesn\u2019t cover any content. &nbsp;If your sticky footer is 75px high, add 80px padding or margin so that the CSS sticky footer doesn\u2019t cover the content at the bottom of your page. &nbsp;The 2 main CSS elements for the sticky footer are&nbsp;<code>position: fixed;<\/code>&nbsp;and&nbsp;<code>bottom: 0px;<\/code><\/p>\n\n\n\n<p>The important thing to understand about&nbsp;&nbsp;<code>position: fixed;<\/code>&nbsp;in a CSS sticky footer is that it\u2019s in a fixed position&nbsp;<em>relative<\/em>&nbsp;to the element or \u201ccontainer\u201d it\u2019s in.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">CSS Sticky Footer<\/h2>\n\n\n\n<p>The\u00a0<strong>main points for the CSS sticky footer<\/strong>\u00a0are\u00a0<code>position: fixed;<\/code>\u00a0and\u00a0<code>bottom: 0px; Z-index helps keep it \"on top\" when the user scrolls.<\/code><\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.stickyFooter {\n     position: fixed;\n     bottom: 0px;\n     width: 100%;\n     overflow: visible;\n     z-index: 99;\n     padding-top: 5px;\n     padding-bottom: 3px;\n     background: white;\n     border-top: solid white 2px;\n     background-color: #89D4DF;\n     -webkit-box-shadow: 0px -5px 15px 0px #bfbfbf;\n     box-shadow: 0px -5px 15px 0px #bfbfbf;\n     height: 34px;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">HTML for CSS Sticky Footer<\/h2>\n\n\n\n<p>This is just a general idea of the HTML needed for your CSS sticky footer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;body>\n   &lt;div id=\"wrapper\">\n      &lt;p>lots of content&lt;\/p>\n   &lt;\/div>\n   &lt;div id=\"stickyFooter\">\n      &lt;p>Content for sticky footer&lt;\/p>\n   &lt;\/div>\n&lt;\/body><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">CSS Sticky Footer, Sticky Header, and Sticky Side Bar Demo<\/h2>\n\n\n\n<p>The\u00a0<strong>demo link below has a CSS\u00a0<em>sticky footer<\/em>,\u00a0<em>sticky header<\/em>, and a\u00a0<em>sticky sidebar<\/em><\/strong>. Note where the HTML for the sticky side bar is within the \u201cwrapper\u201d(&lt;div id=\u201dwrapper\u201d>). The sticky sidebar helps illustrate that it is in a\u00a0<strong>fixed position relative to the \u201ccontainer\u201d it\u2019s within<\/strong>. The sticky footer and header are outside of the \u201cwrapper.\u201d The CSS sticky footer and header are fixed relative to the body tag. The body tag is the \u201ccontainer.\u201d Also\u00a0<strong>notice margins<\/strong>\u00a0added to header and footer to compensated for sticky footer and header so that they don\u2019t cover content the way the sticky sidebar does.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"http:\/\/www.surfingsuccess.com\/demos\/sticky-footer\/sticky\/\" target=\"_blank\">View Demo\u00a0<strong><em>CSS Sticky Footer<\/em><\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are several tutorials on how to make a&nbsp;CSS sticky footers&nbsp;sticky header, or sticky sidebar. &nbsp;This is one. Remember to compensate at the bottom of your page so the CSS sticky footer doesn\u2019t cover any content. &nbsp;If your sticky footer is 75px high, add 80px padding or margin so that the CSS sticky footer doesn\u2019t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":119,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-273","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-uncategorized"},"_links":{"self":[{"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":2,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/posts\/273\/revisions\/275"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/media\/119"}],"wp:attachment":[{"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wshop.fi\/eng\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}