cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              #hero
	.layer-bg.layer{"data-type" => "parallax", "data-depth" => "0.10"}
	.layer-1.layer{"data-type" => "parallax","data-depth" => "0.20"}
	.layer-2.layer{"data-type" => "parallax","data-depth" => "0.50"}
	.layer-3.layer{"data-type" => "parallax","data-depth" => "0.80"}
	.layer-overlay.layer{"data-type" => "parallax","data-depth" => "0.85"}
	.layer-4.layer{"data-type" => "parallax","data-depth" => "1.00"}
#hero-mobile
#content
	.container
		%section.first-section
			.row
				.col-sm-6
					%h1 You cannot hide the soul. Through all his unearthly tattooings, I thought I saw the traces of a simple honest heart.
			.row
				.col-sm-6
					%p   And besides all this, there was a certain lofty bearing about the Pagan, which even his uncouthness could not altogether maim. He looked like a man who had never cringed and never had had a creditor. Whether it was, too, that his head being shaved, his forehead was drawn out in freer and brighter relief, and looked more expansive than it otherwise would, this I will not venture to decide; but certain it was his head was phrenologically an excellent one.
					%p  It may seem ridiculous, but it reminded me of General Washington's head, as seen in the popular busts of him. It had the same long regularly graded retreating slope from above the brows, which were likewise very projecting, like two long promontories thickly wooded on top. Queequeg was George Washington cannibalistically developed.
					%p Whilst I was thus closely scanning him, half-pretending meanwhile to be looking out at the storm from the casement, he never heeded my presence, never troubled himself with so much as a single glance; but appeared wholly occupied with counting the pages of the marvellous book. Considering how sociably we had been sleeping together the night previous, and especially considering the affectionate arm I had found thrown over me upon waking in the morning, I thought this indifference of his very strange. But savages are strange beings; at times you do not know exactly how to take them.
					
				.col-sm-6
					%p  At first they are overawing; their calm self-collectedness of simplicity seems a Socratic wisdom. I had noticed also that Queequeg never consorted at all, or but very little, with the other seamen in the inn. He made no advances whatever; appeared to have no desire to enlarge the circle of his acquaintances. All this struck me as mighty singular; yet, upon second thoughts, there was something almost sublime in it. Here was a man some twenty thousand miles from home, by the way of Cape Horn, that is—which was the only way he could get there—thrown among people as strange to him as though he were in the planet Jupiter; and yet he seemed entirely at his ease; preserving the utmost serenity; content with his own companionship; always equal to himself.
					%p Here was a man some twenty thousand miles from home, by the way of Cape Horn, that is—which was the only way he could get there—thrown among people as strange to him as though he were in the planet Jupiter; and yet he seemed entirely at his ease; preserving the utmost serenity; content with his own companionship; always equal to himself. Surely this was a touch of fine philosophy; though no doubt he had never heard there was such a thing as that. 
					%a.tutorial-link{:href => "https://medium.com/@PatrykZabielski/how-to-make-multi-layered-parallax-illustration-with-css-javascript-2b56883c3f27"}
						Learn how to create this parallax effect
            
          
!
            
              // Preview of the tutorial by Patryk Zabielski
// www.dribbble.com/zabielski | www.patrykzabielski.com
// Tutorial: https://medium.com/@PatrykZabielski/how-to-make-multi-layered-parallax-illustration-with-css-javascript-2b56883c3f27

$bronze: #130d0a;
$white: #fff;
$heroHeight: 800px;

body {
	padding: 0;
	margin: 0;
	background-color: $bronze;
	font-family: 'Playfair Display', serif;
	color: $white;
}

#hero {
	height: $heroHeight;
	overflow: hidden;
	position: relative;
}
#content {
	background-color: $bronze;
}
.layer {
	background-position: bottom center;
	background-size: auto;
	background-repeat: no-repeat;
	width: 100%;
	height: $heroHeight;
	position: fixed;
	z-index: -1;
}

#hero-mobile {
	display: none;
	background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/full_illustration.png") no-repeat center bottom / cover;
	height: 320px;
}

.first-section {
	padding: 50px 0 20px 0;
}
.text-header {
	font-size: 50px;
	text-align: center;
}
h1 {
	line-height: 120%;
	margin-bottom: 30px;
}
p {
	color: #ede0d5;
	font-size: 18px;
	line-height: 150%;
}

#hero, .layer {
	min-height: 800px;
}

.layer-bg {
	background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_bg.jpg');
}
.layer-1 {
	background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_03.png
		');
		background-position: left bottom;
		}
.layer-2 {
	background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_02.png');
}
.layer-3 {
	background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_man.png
		');
		background-position: right bottom;
		}
.layer-4 {
	background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_01.png
		');

		}
.layer-overlay {
	background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_overlay.png
		');

		}


// Media Queries
@media only screen and (max-width: 768px) {
	#hero {
		display: none;
	}
	#hero-mobile {
		display: block;
	}
}


// Additional
.tutorial-link {
	color: $white;
	font-size: 18px;
	text-decoration: underline;
	&:hover {
		color: #ede0d5;
	}
}
            
          
!
            
              # Tutorial: https://medium.com/@PatrykZabielski/how-to-make-multi-layered-parallax-illustration-with-css-javascript-2b56883c3f27

window.addEventListener 'scroll', (event) ->
  topDistance = @pageYOffset 
  layers = document.querySelectorAll("[data-type='parallax']")
  
  for layer in layers
    depth = layer.getAttribute('data-depth')
    movement = -(topDistance * depth)
    translate3d = 'translate3d(0, ' + movement + 'px, 0)'
    layer.style['-webkit-transform'] = translate3d
    layer.style['-moz-transform'] = translate3d
    layer.style['-ms-transform'] = translate3d
    layer.style['-o-transform'] = translate3d
    layer.style.transform = translate3d
  return
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console