Example Css Parallax

Example Css Parallax

by Adi Jaya

HTML

<div class='parallax parallax-1'>
  <div class='header'>
    <h1>Example Css Parallax</h1>
  </div>
</div>


<div class='content bg-white'>
    <p>
    Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
    when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    It has survived not only five centuries, but also the leap into electronic typesetting,
    remaining essentially unchanged.
    It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
    and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </p>
</div>


<div class='parallax parallax-2'></div>


<div class='content bg-black'>
    <p>
    Lorem Ipsum is simply dummy text of the printing and typesetting industry.
    Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
    when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    It has survived not only five centuries, but also the leap into electronic typesetting,
    remaining essentially unchanged.
    It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
    and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </p>
</div>


<div class='parallax parallax-3'>
    <div class='content'>
        <p>
        Lorem Ipsum is simply dummy text of the printing and typesetting industry.
        Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
        when an unknown printer took a galley of type and scrambled it to make a type specimen book.
        It has survived not only five centuries, but also the leap into electronic typesetting,
        remaining essentially unchanged.
        It was popularised in the 1960s with...

CSS

body {
    background: #fff;
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.7;
}


.header {
    position: absolute;
    top: 40%;
    text-align: center;
    left: 0;
    right: 0;
}

.header h1 {
    line-height: 1;
    background: rgba(33, 32, 32, 0.54);
    margin: 0;
    display: inline;
    padding: 10px 25px;
    font-weight: normal;
    color: #e8e8e8;
    border-radius: 4px;
    font-size: 1.7em;
}

.parallax-1 {
  height: 100vh;
  background: #333 url(http://lorempixel.com/1600/700/abstract/1/);
}

.parallax-2 {
  height: 70vh;
  background: #000 url(http://lorempixel.com/1600/700/nightlife/2/);
}

.parallax-3 {
  background: #333 url(http://lorempixel.com/1600/700/nature/3/);
}

.parallax {
  position: relative;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.content {
  padding: 50px 80px;
}

.bg-white {
    background: #fff;
    color: #333;
}

.bg-black {
    background: #555;
    color: #fff;
}