Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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.

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

Behavior

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.

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                <header>
  <div id="menu">
    <ul>
      <li><a class="button active" href="#home">Home</a></li>
      <li><a class="button" href="#about">About</a></li>
      <li><a class="button" href="#services">Services</a></li>
      <li><a class="button" href="#projects">Projects</a></li>
      <li><a class="button" href="#contact">Contact</a></li>
    </ul>
  </div>
</header>

<section id="home">
  <p class="fading"></p>
</section>

<section id="about">
  <p>About</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s
    keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
<section id="services">
  <p>Services</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s
    keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
<section id="projects">
  <p>Projects</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s
    keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
<section id="contact">
  <p>Contact</p>
  <p class="fading">The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s
    keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.</p>
</section>
              
            
!

CSS

              
                * {
  margin: 0;
}

body, a {
  color: seashell;
}

header, section {
  text-align: center;  
}

#menu {
  width: 100%;
  position: fixed;
  text-decoration: none;
  background: rgba(40,40,40,0.7);
  padding: 20px 0;
  z-index: 1;
}

#menu a {
  font-family: helvetica, arial;
  font-size: 17px;
  font-weight: bold;
  text-decoration: none;
  text-shadow: 0 0 4px black;
}

#menu li {
  display: inline-block;
  list-style-type: none;
  margin: 0 15px;
}

#menu .active {
  color: yellow;
}

section {
  height: 100vh;
  position: relative;
  background: grey;
  border-top: 1px solid #4c4c4c;
  box-sizing: border-box;
}

section p:first-child {
  font-family: helvetica, arial;
  font-size: 23px;
  line-height: 30px;
  text-shadow: 0 0 5px black;
  padding: 10px 0 25px;
  margin-top: 70px;
}

.fading {
  margin: 0 50px;
  opacity: 0;
}

#home {
  background: url(//i.imgsafe.org/3015a7e989.jpg) center / cover;
}
              
            
!

JS

              
                $(function() {

	var modern = window.requestAnimationFrame,
	target = $('.fading'), zenith, nadir, spot, pilot;

	$(window).resize(storeDimensions).scroll(function() {

		spot = $(this).scrollTop();

		if (!pilot) {
		if (modern) requestAnimationFrame(checkFade);
		else checkFade();
		}
	}).resize();

	$('.button').click(function(e) {

		e.preventDefault();
		pilot = true;

		$('.active').removeClass('active');
		$(this).addClass('active');

		var destination = $(this.hash).offset().top,
		goal = $(this.hash).find('.fading');

		if (destination != spot && goal.length) goal.stop().fadeOut();

		$('html, body').animate({scrollTop: destination}, 600, function() {

			if (goal.length) goal.fadeTo(1500,1);
			pilot = false;
		});
	});

function storeDimensions() {

	zenith = []; nadir = [];

	target.each(function() {

		var placement = $(this).offset().top;

		zenith.push(placement-$(window).height()*0.8);
		nadir.push(placement+$(this).outerHeight());
	});
}

function checkFade() {

	target.each(function(i) {

		if (!$(this).is(':animated')) {
		if (spot > zenith[i] && spot < nadir[i]) {
		$(this).fadeTo(1500,1);
		var pair = $(this).closest('section')[0].id;
		$('.active').removeClass('active');
		$('[href*="' + pair + '"]').addClass('active');
		}
		else if ($(this).css('opacity') != 0) $(this).fadeTo(0,0);
		}
	});
}
});
              
            
!
999px
Keep friends close and formatters closer.

Console