I have created a pure CSS3 parallax webpage by following the method outlined by Keith Clark and using a sample made by Carl Henderson (I can't provide a direct link to his codepen due to my lack of reputation). You can find the code in the main page, on my JSFiddle, and also on Carl's Codepen.
index.html
<div class="plax_layer plax_layer--back">
<p>Back Layer</p>
</div>
<div class="plax_layer plax_layer--base">
<p>Base Layer</p>
</div>
<div class="plax_layer plax_layer--deep">
<p>Deep Layer</p>
</div>
</div>
main.css
html, body {
height: 100%;
overflow: hidden;
}
.parallax {
top: 0;
-webkit-perspective: 1px;
-moz-perspective: 1px;
-ms-perspective: 1px;
perspective: 1px;
height: 100vh;
overflow-x: hidden;
}
.plax_layer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
font-size: 200%;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.plax_layer--base {
-webkit-transform: translatez(0) scale(1);
-moz-transform: translatez(0) scale(1);
-ms-transform: translatez(0) scale(1);
-o-transform: translatez(0) scale(1);
transform: translatez(0) scale(1);
border: 2px solid red;
}
.plax_layer--back {
-webkit-transform: translatez(-1px) scale(2);
-moz-transform: translatez(-1px) scale(2);
-ms-transform: translatez(-1px) scale(2);
-o-transform: translatez(-1px) scale(2);
transform: translatez(-1px) scale(2);
border: 2px solid blue;
}
.plax_layer--deep {
-webkit-transform: translatez(-2px) scale(3);
-moz-transform: translatez(-2px) scale(3);
-ms-transform: translatez(-2px) scale(3);
-o-transform: translatez(-2px) scale(3);
transform: translatez(-2px) scale(3);
border: 2px solid green;
}
p {
position: absolute;
}
I'm facing an issue where the code works perfectly on Chrome and Safari, but Mozilla Firefox fails to display the desired effect unless I open the Inspector window (and stops when I close it). Additionally, it only works correctly in my Fiddle after I've resized the output window. So far, I haven't encountered similar problems with Google Chrome.