{"id":28185,"date":"2016-10-11T23:01:31","date_gmt":"2016-10-11T15:01:31","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=28185"},"modified":"2025-04-04T00:03:04","modified_gmt":"2025-04-03T16:03:04","slug":"css-only-on-scroll-reveal","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/","title":{"rendered":"How to Create CSS-only Sticky Footer"},"content":{"rendered":"<p>Normally, we need JavaScript to <strong>perform scrolling effects<\/strong> related to different user actions on web pages. The script does the job of <strong>tracking how far up or down scrolling takes a page<\/strong>, and <strong>triggers an action<\/strong> when a threshold height is reached.<\/p>\n<p>It\u2019s not particularly a bad thing to use JavaScript for scrolling effects. In fact there are more complicated cases that are <strong>impossible to solve without JavaScript<\/strong>. However there are <strong>CSS hacks<\/strong> that can replace these scripts at times.<\/p>\n<p>This post is going to show you ho<strong>w to create footer reveal effects on page scroll using CSS. <\/strong>We will be using  two  use cases to demonstrate this: one for the entire page (see demo) & one for individual page elements, such as articles.<\/p>\n<p class=\"recommended_top\">\n\t\t\t\t\t<strong>Read Also:<\/strong>\u00a0\n\t\t\t\t\t<a target=\"_blank\" href=\"https:\/\/www.hongkiat.com\/blog\/html5-basic-elements\/\">HTML5 Basic Elements: Header, Nav, and Footer<\/a>\n\t\t\t\t<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif\" width=\"800\" height=\"485\" alt=\"Full Page Demo\"><\/figure>\n<h2>Full Page<\/h2>\n<p>We need to create a footer that <strong>appears from beneath the page<\/strong> while the user is scrolling down. Also, when they are scrolling the page back up the footer needs to <strong>be hidden<\/strong> beneath the page again.<\/p>\n<p>To achieve this goal, first we have to create a <strong>footer with fixed position<\/strong> at the bottom of the screen.<\/p>\n<h3>1. Create a Fixed Footer<\/h3>\n<p>Let\u2019s <strong>add some content and a footer<\/strong> to the page first. I\u2019m using the HTML tags <code>&lt;main&gt;<\/code> and <code>&lt;footer&gt;<\/code> for semantics. However, <code>&lt;div&gt;<\/code> works as well.<\/p>\n<p>In my demo, there\u2019s a bat image shown inside the footer for a not-so spooky effect, but you can choose any other image you like.<\/p>\n<pre>\r\n&lt;main&gt;\r\n  &lt;h2&gt;Keep scrolling till you see the footer&lt;\/h2&gt;\r\n  &lt;p&gt;Lorem ipsum dolor sit amet...&lt;\/p&gt;\r\n  &lt;!-- some more paragraphs --&gt;\r\n&lt;\/main&gt;\r\n&lt;footer&gt;\r\n\t&lt;img src=\"bat.svg\" width=\"100%\"&gt;\r\n&lt;\/footer&gt;\r\n<\/pre>\n<p>Moving to CSS, <strong>remove any space<\/strong> around the <code>&lt;body&gt;<\/code> tag by <strong>setting margins to 0<\/strong>, and make it long enough by <strong>adding a custom height<\/strong> to induce scrolling  (if the body content in your page is long enough to cause scrolling, you don\u2019t have to give it a height).<\/p>\n<p>Give some dimensions (<code>width<\/code> and <code>height<\/code>) to the footer, and <strong>fix its position<\/strong> to the bottom of the screen with the <code>position: fixed;<\/code> and <code>bottom: 0;<\/code> properties.<\/p>\n<pre>\r\nbody {\r\n  font-family: Crimson Text;\r\n  font-size: 13pt;\r\n  margin: 0;\r\n}\r\nfooter {\r\n  width: 100%;\r\n  height: 200px;\r\n  position: fixed;\r\n  bottom: 0;\r\n  background-color: #DD5632;\r\n}\r\n<\/pre>\n<h3>2. Hide the Footer<\/h3>\n<p>Apply the <code>z-index:-1<\/code> rule to the footer in order to <strong>place it behind all other elements<\/strong> on the page.<\/p>\n<p>Color both the <code>&lt;body&gt;<\/code> and <code>&lt;html&gt;<\/code> tags white in order to <strong>cover the footer<\/strong>.<\/p>\n<pre>\r\nbody, html{\r\n\tbackground-color: #fff;\r\n}\r\nfooter {\r\n  width: 100%;\r\n  height: 200px;\r\n  position: fixed;\r\n  bottom: 0;\r\n  background-color: #DD5632;\r\n  z-index: -1;\r\n}\r\n<\/pre>\n<h3>3. Adjust the Bottom Margin<\/h3>\n<p>Set the <code>margin-bottom<\/code> of the <code>&lt;body&gt;<\/code> tag <strong>equal to the height of the footer<\/strong> (in my example 200px).<\/p>\n<p>This way there will be enough space at the bottom for the footer to <strong>be visible<\/strong> when the user scrolls down the page.<\/p>\n<pre>\r\nbody {\r\n  height: 1000px;\r\n  margin: 0;\r\n  margin-bottom: 200px;\r\n}\r\n<\/pre>\n<p>That\u2019s it. The footer reveal effect for a full web page is done. Check out the Codepen demo below.<\/p>\n<p><iframe height=\"465\" scrolling=\"no\" src=\"https:\/\/codepen.io\/\/hkdc\/embed\/BLJAVL\/?height=465&theme-id=0&default-tab=result&embed-version=2\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a href=\"https:\/\/codepen.io\/\/hkdc\/pen\/BLJAVL\/\" rel=\"nofollow\">Page Footer Reveal (Pure CSS) <\/a> by HONGKIAT (<a href=\"https:\/\/codepen.io\/\/hkdc\" rel=\"nofollow\">@hkdc<\/a>) on <a href=\"https:\/\/codepen.io\/\" rel=\"nofollow\">CodePen<\/a>. <\/iframe><\/p>\n<h2>Individual Page Elements<\/h2>\n<p>This technique can be used for an individual HTML element (with a footer) that\u2019s <strong>long enough<\/strong> for a proper page scroll effect. The method is a bit hacky, as it currently <a href=\"https:\/\/caniuse.com\/#search=position%3A%20sticky\" target=\"_blank\" rel=\"noopener\">doesn\u2019t work in Chrome and IE<\/a>, but it has a decent fallback.<\/p>\n<h3>1. Create a Long Article<\/h3>\n<p>First, let\u2019s create a long article with a footer. To promote semantic code, I chose <code>&lt;article&gt;<\/code> and <code>&lt;footer&gt;<\/code>.<\/p>\n<pre>\r\n&lt;article&gt;\r\n    &lt;h2&gt;Article 1&lt;\/h2&gt;\r\n    &lt;p&gt;Lorem ipsum dolor sit amet...&lt;\/p&gt;\r\n    &lt;!-- some more paragraphs --&gt;\r\n    &lt;footer&gt;&lt;\/footer&gt;\r\n&lt;\/article&gt;\r\n<\/pre>\n<p>Below you can see the <strong>basic styling<\/strong> of the article and the footer.<\/p>\n<pre>\r\narticle{\r\n    width: 500px;\r\n    background-color:#FEF9F3;\r\n    padding: 20px 40px;\r\n}\r\narticle&gt;footer{\r\n    height: 100px;\r\n    background-color: #FE0178;\r\n}\r\nbody{\r\n    font-family: cormorant garamond;\r\n}\r\n<\/pre>\n<p>My article currently looks like this. Of course you can use other basic style rules as well.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/css-scroll-effect-article.jpg\" alt=\"Article and Footer\" width=\"800\" height=\"677\"><figcaption>Article with Footer \u2013 Basic Styling<\/figcaption><\/figure>\n<h3>2. Make the Footer Sticky<\/h3>\n<p>The previous footer was fixed, this one is going to <strong>be sticky<\/strong>. Apply the <code>position:sticky<\/code> rule to the footer, so it will move inside the boundaries of the article but still <strong>maintain its position<\/strong> on the screen while the user is scrolling up and down.<\/p>\n<pre>\r\narticle&gt;footer{\r\n    height: 100px;\r\n    background-color: #FE0178;\r\n    position: -webkit-sticky;\r\n    position: sticky;\r\n    bottom: 80px;\r\n}\r\n<\/pre>\n<p>The <code>bottom:80px<\/code> rule fixes the position of the footer <strong>80px above the bottom of the article<\/strong>.<\/p>\n<p>You can adjust its value to your taste, since it determines the point where the footer starts to appear or disappear while the user is scrolling down or up.<\/p>\n<p>Give the <strong>same value for the bottom margin of the article<\/strong>, so that there will enough space at the bottom to reveal the full footer.<\/p>\n<pre>\r\narticle{\r\n    width: 500px;\r\n    background-color:#FEF9F3;\r\n    padding: 20px 40px;\r\n    margin-bottom: 80px;\r\n}\r\n<\/pre>\n<h3>3. Add a Partially Transparent Background<\/h3>\n<p>Now we need <strong>an opening next the bottom of the article<\/strong> through which we can see the sticky footer scrolling down and up.<\/p>\n<p>To achieve this, replace the <code>background-color<\/code> of the article with a <strong>linear gradient<\/strong> <code>background-image<\/code>, which from the top of the article to the top of the footer is <strong>colored with the background color<\/strong> of the article, and the remaining portion to the bottom is <strong>made transparent<\/strong>.<\/p>\n<pre>\r\narticle{\r\n    width: 500px;\r\n    padding: 20px 40px;\r\n    background-image:linear-gradient(\r\n                  to bottom, #FEF9F3 calc(100% - 120px),\r\n                  transparent 0);\r\n    margin-bottom: 80px;\r\n}\r\n<\/pre>\n<p>The<code><a href=\"https:\/\/developer.mozilla.org\/en\/docs\/Web\/CSS\/calc\" target=\"_blank\" rel=\"noopener\">calc<\/a>(100%-120px)<\/code> CSS function calculates the <strong>full height of the article minus the footer<\/strong>. In my example, it\u2019s 120px (100px for height &plus; 20px for padding).<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/css-scroll-effect-article1.jpg\" alt=\"Article with Sticky Footer and Liner-Gradient Background\" width=\"800\" height=\"652\"><figcaption>Article with Linear-Gradient Background Image & Sticky Footer<\/figcaption><\/figure>\n<h3>4. Place the Footer Back<\/h3>\n<p>Finally, let\u2019s <strong>place the footer behind the article<\/strong> using the <code>z-index: -1<\/code> CSS rule.<\/p>\n<pre>\r\narticle&gt;footer{\r\n    height: 100px;\r\n    background-color: #FE0178;\r\n    position: -webkit-sticky;\r\n    position: sticky;\r\n    bottom: 80px;\r\n    z-index: -1;\r\n}\r\n<\/pre>\n<p>And that\u2019s it, the individual page element with the on-scroll reveal effect is done. Check out the Codepen pen below. You can also find both use cases on <a href=\"https:\/\/github.com\/hongkiat\/on-scroll-footer\/\" target=\"_blank\" rel=\"noopener\">our Github page<\/a>.<\/p>\n<p><iframe height=\"388\" scrolling=\"no\" src=\"https:\/\/codepen.io\/\/hkdc\/embed\/qapKNj\/?height=388&theme-id=0&default-tab=result&embed-version=2\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" style=\"width: 100%;\">See the Pen <a href=\"https:\/\/codepen.io\/\/hkdc\/pen\/qapKNj\/\" rel=\"nofollow\"> Footer Reveal in Elements (Pure CSS) <\/a> by HONGKIAT (<a href=\"https:\/\/codepen.io\/\/hkdc\" rel=\"nofollow\">@hkdc<\/a>) on <a href=\"https:\/\/codepen.io\/\" rel=\"nofollow\">CodePen<\/a>. <\/iframe><\/p>\n<pre>\r\n&lt;div class=\"grid-container\"&gt;\r\n  &lt;div class=\"grid-top\"&gt;Top&lt;\/div&gt;\r\n  &lt;div class=\"grid-left\"&gt;Left&lt;\/div&gt;\r\n  &lt;div class=\"grid-centre\"&gt;centre&lt;\/div&gt;\r\n  &lt;div class=\"grid-right\"&gt;Right&lt;\/div&gt;\r\n  &lt;div class=\"grid-bottom\"&gt;Bottom&lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas:  \"top    top    top\"\r\n                       \"left   centre right\"\r\n                       \"bottom bottom bottom\";\r\n}\r\n.grid-top {\r\n  grid-area: top;\r\n}\r\n.grid-bottom {\r\n  grid-area: bottom;\r\n}\r\n.grid-left {\r\n  grid-area: left;\r\n}\r\n.grid-right {\r\n  grid-area: right;\r\n}\r\n.grid-centre{\r\n  grid-area: centre;\r\n}\r\n<\/pre>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas: \"top    top    top\"\r\n                      \"left   centre right\"\r\n                      \"bottom bottom bottom\";\r\n  grid-template-columns: 100px auto 100px;\r\n  grid-template-rows: 50px  auto 150px;\r\n}\r\n<\/pre>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas: \"top    top    top\"\r\n                      \"left   centre right\"\r\n                      \"bottom bottom bottom\";\r\n  grid-template-columns: 100px auto 100px;\r\n  grid-template-rows: 50px  auto 150px;\r\n  grid-gap: 5px 5px;\r\n}\r\n<\/pre>\n<pre>\r\n.grid-container {\r\n  width: 500px;\r\n  height: 500px;\r\n  display: grid;\r\n  grid-template-areas: \"top    top    top\"\r\n                      \"left   centre right\"\r\n                      \"bottom bottom bottom\";\r\n  grid-template-columns: 100px auto 100px;\r\n  grid-template-rows: 50px  auto 150px;\r\n  grid-gap: 5px 5px;\r\n}\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up or down scrolling takes a page, and triggers an action when a threshold height is reached. It\u2019s not particularly a bad thing to use JavaScript for scrolling effects. In&hellip;<\/p>\n","protected":false},"author":145,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392],"tags":[507,4501],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Create CSS-only Sticky Footer - Hongkiat<\/title>\n<meta name=\"description\" content=\"Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create CSS-only Sticky Footer\" \/>\n<meta property=\"og:description\" content=\"Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-11T15:01:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T16:03:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif\" \/>\n<meta name=\"author\" content=\"Preethi Ranjit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Preethi Ranjit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/\"},\"author\":{\"name\":\"Preethi Ranjit\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\"},\"headline\":\"How to Create CSS-only Sticky Footer\",\"datePublished\":\"2016-10-11T15:01:31+00:00\",\"dateModified\":\"2025-04-03T16:03:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/\"},\"wordCount\":818,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-on-scroll-reveal\\\/full-page-demo.gif\",\"keywords\":[\"CSS\",\"CSS Tutorials\"],\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/\",\"name\":\"How to Create CSS-only Sticky Footer - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-on-scroll-reveal\\\/full-page-demo.gif\",\"datePublished\":\"2016-10-11T15:01:31+00:00\",\"dateModified\":\"2025-04-03T16:03:04+00:00\",\"description\":\"Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-on-scroll-reveal\\\/full-page-demo.gif\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css-only-on-scroll-reveal\\\/full-page-demo.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css-only-on-scroll-reveal\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create CSS-only Sticky Footer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e981676afae36d1ff5feb75094950ab3\",\"name\":\"Preethi Ranjit\",\"description\":\"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/preethi\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Create CSS-only Sticky Footer - Hongkiat","description":"Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/","og_locale":"en_US","og_type":"article","og_title":"How to Create CSS-only Sticky Footer","og_description":"Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up","og_url":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2016-10-11T15:01:31+00:00","article_modified_time":"2025-04-03T16:03:04+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif","type":"","width":"","height":""}],"author":"Preethi Ranjit","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Preethi Ranjit","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/"},"author":{"name":"Preethi Ranjit","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3"},"headline":"How to Create CSS-only Sticky Footer","datePublished":"2016-10-11T15:01:31+00:00","dateModified":"2025-04-03T16:03:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/"},"wordCount":818,"commentCount":2,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif","keywords":["CSS","CSS Tutorials"],"articleSection":["Coding"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/","url":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/","name":"How to Create CSS-only Sticky Footer - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif","datePublished":"2016-10-11T15:01:31+00:00","dateModified":"2025-04-03T16:03:04+00:00","description":"Normally, we need JavaScript to perform scrolling effects related to different user actions on web pages. The script does the job of tracking how far up","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/css-only-on-scroll-reveal\/full-page-demo.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/css-only-on-scroll-reveal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create CSS-only Sticky Footer"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e981676afae36d1ff5feb75094950ab3","name":"Preethi Ranjit","description":"A .NET developer with a JavaScript background, Preethi is expert in front-end coding, JavaScript, HTML, and CSS.","url":"https:\/\/www.hongkiat.com\/blog\/author\/preethi\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-7kB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/28185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/145"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=28185"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/28185\/revisions"}],"predecessor-version":[{"id":73481,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/28185\/revisions\/73481"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=28185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=28185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=28185"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=28185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}