Web Development Kodex

parallax

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Parallax</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Parallax</h1>
</header>
<div class="wrapper">
<div class="parallax"></div>
<div class="container">
<h2>Heading</h2>
<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.
</p>
</div>
<!-- .container-->
<div class="parallax-2"></div>
<div class="container">
<h2>Heading</h2>
<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.
</p>
</div>
<!-- .container-->
<div class="parallax-3"></div>
<div class="container">
<h2>Heading</h2>
<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.
</p>
</div>
<!-- .container-->
</div>
<!-- .wrapper-->
<footer>
<small><a href="https://opensource.org/licenses/MIT">MIT</a></small>
</footer>
</body>
</html>

styles.css

body {
background: #eeeeee;
font-size: 16px;
font-family: "Trebuchet MS", Helvetica, sans-serif;
margin: 0;
}
a {
color: crimson;
text-decoration: none;
}
a:hover {
color: red;
}
/* Layout
------------------------------------------*/
header,
.container,
footer {
margin: 0 auto;
width: 88%;
max-width: 1080px;
}
.wrapper {
padding-bottom: 1em;
background: #ffffff;
}
/* Layout
------------------------------------------*/
.parallax,
.parallax-2,
.parallax-3 {
height: 500px;
background-position: 50% 50%;
background-attachment: fixed;
background-size: cover;
}
.parallax {
background-image: url(images/pyramid.jpg);
}
.parallax-2 {
background-image: url(images/te-tuhirangi-contour.jpg);
}
.parallax-3 {
background-image: url(images/red-cloud-confrontation-in-landscape.jpg);
}