Pure HTML / CSS Parallax Scrolling Effect

Category: Animation , CSS & CSS3 | September 13, 2015
Author: jacted
Views Total: 5,150
Official Page: Go to website
Last Update: September 13, 2015
License: MIT

Preview:

Pure HTML / CSS Parallax Scrolling Effect

Description:

A CSS only implementation of a simple parallax scrolling effect for background image.

How to use it:

Wrap you content into a parallax area.

<section class="parallax parallax-demo">
  <div class="container">
    <h1>Parallax</h1>
  </div>
</section>

The core parallax styles to make the content scroll through the container with a parallax effect when scrolling.

section.parallax {
  position: relative;
  height: auto;
  padding: 180px 0px;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

section.parallax:after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.30);
  z-index: 100;
  content: ' ';
}

section.parallax h1 {
  color: #fff;
  position: relative;
  z-index: 101;
  font-size: 48px;
  line-height: 1.5;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

Add a background image to the parallax container.

section.parallax.parallax-demo {
  background-image: url("image.jpg");
  background-position: 100% 100%;
}

You Might Be Interested In:


Leave a Reply