Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link href='https://fonts.googleapis.com/css?family=Playfair+Display:400,400italic,700|Roboto+Condensed:400,700' rel='stylesheet' type='text/css'>

<section class="hero image-as-background" style="background-image: url('https://images.unsplash.com/photo-1443890923422-7819ed4101c0?crop=entropy&dpr=2&fit=crop&fm=jpg&h=700&ixjsv=2.1.0&ixlib=rb-0.3.5&q=50&w=1300');">
  <div class="hero-container">
    <p class="animate fadeInLeft delay-400">Mazgine cover hero style</p>
    <h1 class="hero-title animate fadeInLeft delay-600">This is a large hero section</h1>
    <a href="#" class="hero-button animate fadeInLeft delay-800" title="Click to see more">Click Me</a>
  </div>
</section>
<section class="main-content">
  <h2>This is the additional content</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. 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>
  
  <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>
  
</section>
              
            
!

CSS

              
                // vars
$font-sans-serif : 'Roboto Condensed', sans-serif;
$font-serif      : 'Playfair Display', serif;

.main-content {
  min-height: 1000px; // just for this pen
}

.hero {
	background-position: 50% 50%;
	background-repeat: no-repeat;
	background-size: cover;
  // needed to prevent janky scrolling in Safari
  backface-visibility: hidden;
  //100% height of the viewport
	height: 100vh;
	overflow: hidden;
	position: relative;
	width: 100%;
	
	@media screen and (min-width:640px) {
		background-position: 50% 0;
	}

	// Add a slight overlay on our image
	&:after {
		background-color: rgba(62,92,135,.5);
		bottom: 0;
		content: '';
		left: -2000%;
		position: absolute;
		right: -2000%;
		top: 0;
		z-index: 1;
	}
}

.hero-container {
	box-sizing: border-box;
	height: auto;
	padding: 30px 50px;
	position: relative;
	z-index: 2;
  
  // set our fade for when the JS kicks in on scroll
  -webkit-transition-timing-function: cubic-bezier(0.7,0,0.3,1);
    transition-timing-function: cubic-bezier(0.7,0,0.3,1);
    -webkit-transition-duration: 1.2s;
    transition-duration: 1.2s;
	
	@media screen and (min-width:640px) {
		height: 100%;
	}

	p {
		color: white;
		font-family: $font-sans-serif;
		font-size: 13px;
    font-weight: bold;
		letter-spacing: 6px;
    opacity: 0.8;
    text-transform: uppercase;
    text-align: left;
	}
}

.hero-button {
  background: rgba(255,255,255,0.8);
  color: #44575b;
  font-size: 24px;
  float: left;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 30px;
  padding: 20px 90px;
  text-decoration: none;
}

.hero-title {
	color: white;
	font-family: $font-serif;
  // Respond to viewport width–works well since
  // we're sizing the image according viewport height
	font-size: 17vw; 
	font-weight: 500;
	letter-spacing: 1px;
  line-height: 1.1;
  margin: 5px 0;
  text-align: left;
  width: 85%;
  
  @media screen and (min-width:640px) {
		font-size: 10vw;
	}
}

.main-content {
  height: auto;
	padding: 30px 50px;
	position: relative;
  width: 60%;
}

.main-content p {
  color: #25373D;
  font-family: $font-serif;
  font-size: 18px;
  line-height: 1.5;
}

// Start Animation Tweaks
// Need to refactory and Sassify–just proof-of-concept and testing right now
// Basically tweaking transform, translates inside keyframes and adding delays

@keyframes fadeInLeft {
  from {
    opacity: 0;
    -webkit-transform: translate3d(-12px, 0, 0);
    //transform: translate3d(-100%, 0, 0);
    transform: translate3d(-12px, 0, 0);
  }

  to {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

.fadeInLeft {
  -webkit-animation-name: fadeInLeft;
  animation-name: fadeInLeft;
}

.animate {
    animation-duration: 0.75s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.2, 0.3, 0.25, 0.9);
}

.delay {
  animation-delay: 1s;
}

.delay-400 {
  animation-delay: 0.4s;
}

.delay-500 {
  animation-delay: 0.5s;
}

.delay-600 {
  animation-delay: 0.6s;
}

.delay-700 {
  animation-delay: 0.7s;
}

.delay-800 {
  animation-delay: 0.8s;
}
              
            
!

JS

              
                /**
 * Hero fade transition
 */
window.HeroFade_Object = {};
( function( window, $, that ) {

	// Constructor.
	that.init = function() {
		that.cache();

		if ( that.meetsRequirements ) {
			that.bindEvents();
		}
	};

	// Cache all the things.
	that.cache = function() {
		that.$c = {
			window: $(window),
			heroSelector: $( '.hero' ),
		};
	};

	// Combine all events.
	that.bindEvents = function() {
		that.$c.window.on( 'load', that.doHero );
	};

	// Do we meet the requirements?
	that.meetsRequirements = function() {
		return that.$c.heroSelector.length;
	};

	// Watch the user scroll position and fade the hero
	that.doHero = function() {
		  $(window).scroll(function(){
          // transition the fade by dividing div height & opacity
          $( ".hero" ).css("opacity", 1 - $(window).scrollTop() / $('.hero').height());
      });
	};

	// Engage!
	$( that.init );

})( window, jQuery, window.HeroFade_Object );
              
            
!
999px

Console