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.

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.

HTML

              
                <link rel="stylesheet" href="//weloveiconfonts.com/api/?family=fontawesome" />

<span class="icon"></span>
<nav id="menu" class="off">
    <div>
	  <a onclick="animatescroll('#home');" class="home-link active">
	  	<span>Home</span>
	  </a>
	  <a onclick="animatescroll('#about');" class="about-link">
	  	<span>About</span>
	  </a>
	  <a onclick="animatescroll('#portfolio');" class="portfolio-link">
	  	<span>Portfolio</span>
	  </a>
	  <a onclick="animatescroll('#blog');" class="blog-link">
	  	<span>Blog</span>
	  </a>
	  <a onclick="animatescroll('#contact');" class="contact-link">
	  	<span>Contact</span>
	  </a>
    </div>
</nav>

<section id="home">
  <div class="container">
<h1>Home</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur atque repellendus aliquam modi numquam eius voluptatem unde eaque voluptas facere quisquam illo deserunt ratione fugiat nisi ea nemo sequi quo fugit ipsum quaerat optio sit vitae ducimus dolor totam temporibus. Minima quasi rem dolores quo voluptates doloribus illo? Adipisci itaque!</p>
  </div>
</section>

<section id="about">
  <div class="container">
<h1>About</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur atque repellendus aliquam modi numquam eius voluptatem unde eaque voluptas facere quisquam illo deserunt ratione fugiat nisi ea nemo sequi quo fugit ipsum quaerat optio sit vitae ducimus dolor totam temporibus. Minima quasi rem dolores quo voluptates doloribus illo? Adipisci itaque!</p>
<p>Minus voluptatem pariatur deleniti nesciunt reprehenderit provident corporis! Quisquam porro veniam dolore perspiciatis eos minus aperiam odio unde quod non ipsa explicabo ullam recusandae reprehenderit voluptatibus nobis velit repellat illo rerum omnis. Quisquam fugiat ad necessitatibus nulla soluta. Eligendi tenetur consequatur debitis odio quibusdam harum veniam dolorem voluptatibus repudiandae ipsum.</p>
  </div>
</section>

<section id="portfolio">
  <div class="container">
<h1>Portfolio</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur atque repellendus aliquam modi numquam eius voluptatem unde eaque voluptas facere quisquam illo deserunt ratione fugiat nisi ea nemo sequi quo fugit ipsum quaerat optio sit vitae ducimus dolor totam temporibus. Minima quasi rem dolores quo voluptates doloribus illo? Adipisci itaque!</p>
<p>Minus voluptatem pariatur deleniti nesciunt reprehenderit provident corporis! Quisquam porro veniam dolore perspiciatis eos minus aperiam odio unde quod non ipsa explicabo ullam recusandae reprehenderit voluptatibus nobis velit repellat illo rerum omnis. Quisquam fugiat ad necessitatibus nulla soluta. Eligendi tenetur consequatur debitis odio quibusdam harum veniam dolorem voluptatibus repudiandae ipsum.</p>
<p>Dolorem asperiores repudiandae iste voluptatibus laboriosam officiis soluta id nesciunt architecto eius cupiditate hic dolore voluptatum fugiat omnis saepe vel temporibus nobis magni unde. Aliquam animi eum nostrum eos nam fugiat ullam deserunt tempora laudantium odio nihil magni recusandae quis harum quasi sunt iusto perferendis corporis placeat et earum libero.</p>
  </div>
</section>

<section id="blog">
  <div class="container">
<h1>Blog</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur atque repellendus aliquam modi numquam eius voluptatem unde eaque voluptas facere quisquam illo deserunt ratione fugiat nisi ea nemo sequi quo fugit ipsum quaerat optio sit vitae ducimus dolor totam temporibus. Minima quasi rem dolores quo voluptates doloribus illo? Adipisci itaque!</p>
  </div>
</section>

<section id="contact">
  <div class="container">
<h1>Contact</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestias deserunt.</p>
<form action="#">
  <div>
    <label for="name">Name</label>
    <input type="text" placeholder="That One Guy" />
  </div>
  
  <div>
    <label for="name">Email</label>
    <input type="email" placeholder="sample@email.com" />
  </div>

  <div>
    <label for="textarea">Message</label>
    <textarea cols="40" rows="8" name="textarea" id="textarea" placeholder="What's up?"></textarea>
  </div>

  <div>
    <input type="submit" value="Send" />
  </div>
</form>  
  </div>
</section>

<footer>
  <p>This has been a pen.</p>
</footer>
              
            
!

CSS

              
                * { box-sizing: border-box; }

body {
  font-family: 'Open Sans';
  color: #fff;
  font-size: 1.5em;
  font-weight: 300;
}

.container {
  width: 80%;
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  font-size: 2em;
  margin: 0 0 1em;
}

h1:before {
  font-family: 'FontAwesome';
  color: #fff;
  margin-right: .5em;
}

#home h1:before, .home-link:before { content: '\f015'; }
#about h1:before, .about-link:before { content: '\f075'; }
#portfolio h1:before, .portfolio-link:before { content: '\f0f2'; }
#blog h1:before, .blog-link:before { content: '\f09e'; }
#contact h1:before, .contact-link:before { content: '\f0e0'; }

p {
  margin: 0 0 1em;
  line-height: 1.25em;
  text-align: justify;
}

/* -- Menu CSS -- */

#menu {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 70px;
  padding: 1em 3em;
  overflow: hidden;
  transition: all 0.5s;
}

#menu div { width: 9999px; }

.icon {
  font-family: 'FontAwesome';
  color: #fff;
  font-size: 1.5em;
  cursor: pointer;
  display: block;
  position: fixed;
  top: 17px; left: 22px;
  z-index: 21;
}

.icon:before { content: '\f0c9'; }

#menu a:before {
  font-family: 'FontAwesome';
  margin-right: .5em;
}

#menu.off a { display: none; }

#menu.on {
  background: rgba(0,0,0,0.75);
  width: 100%;
}

#menu.on a {
  display: inline-block;
  text-decoration: none;
  margin: 0 1em;
  padding: 0;
  font-size: .75em;
  color: #fff;
  cursor: pointer;
}

#menu.on a:before { display: none; }

#menu.on a:hover, #menu.on a.active {
  color: #888;
  padding-bottom: 1px;
}

@media screen and (min-width: 43.75em) {
  .icon { display: none; }
  #menu {
    width: auto; height: auto;
    padding: 0;
    background: 0;
    top: 20px;
  }
  #menu a { 
    display: block;
    width: 60px; height: 50px;
    padding: .2em .5em;
    cursor: pointer;
    overflow: hidden;
    background: rgba(0,0,0,.75);
  }
  #menu a:before { font-size: 1.5em; transition: color 0.2s; }
  #menu a:hover { width: 200px; }
  #menu a span { opacity: 0; }
  #menu a:hover span { opacity: 1; }
  
  #menu .home-link:hover:before, #menu .home-link.active:before { color: #47a0e5; }
  #menu .about-link:hover:before, #menu .about-link.active:before { color: #d94a53; }
  #menu .portfolio-link:hover:before, #menu .portfolio-link.active:before { color: #f59416; }
  #menu .blog-link:hover:before, #menu .blog-link.active:before { color: #5ebd66; }
  #menu .contact-link:hover:before, #menu .contact-link.active:before { color: #bfa5c4; }
}

/* -- Content Area CSS -- */

section { padding: 3em 2em; }
footer { padding: 2em 0 .25em; background: #666; }
footer p { font-size: .75em; text-align: center; }

#home { background: #47a0e5; padding-top: 7em; }
#about { background: #d94a53; }
#portfolio { background: #f59416; }
#blog { background: #5ebd66; padding-top: 7em; }
#contact { background: #bfa5c4; }

label { display: block; font-size: .75em; margin: 0 0 .25em .5em; }
input, textarea { margin: 0 0 1em; padding: .5em; outline: 0; border: 1px solid #666; width: 75%; max-width: 400px; font-family: 'Open Sans'; }
input[type="submit"] { background: #47a0e5; width: auto; border: 0; padding: .5em 1em; font-size: .8em; color: #fff; cursor: pointer; transition: background 0.5s; }
input[type="submit"]:hover { background: #3F8FCC; }
              
            
!

JS

              
                function secHeight() {
  var vpHeight = $(window).height();
  $('section').css('min-height', vpHeight);
}

function mClose() {
  if ($('#menu').hasClass('on')) {
      $('#menu').addClass('off').removeClass('on');
  }
}

function animatescroll(id) {
  $('body, html').animate({
    scrollTop: $(id).offset().top
  }, 500);
}

function mSection() {
  var topHome = $('#home').offset().top,
      topAbout = $('#about').offset().top,
      topPort = $('#portfolio').offset().top,
      topBlog = $('#blog').offset().top,
      topCont = $('#contact').offset().top,
      menuAll = $('#menu a').removeClass('active');
  
  if ($(window).scrollTop() < topAbout) {
    menuAll;
    $('#menu a:contains("Home")').addClass('active');
  } else if ($(window).scrollTop() >= topCont) {
    menuAll;
    $('#menu a:contains("Contact")').addClass('active');
  } else if ($(window).scrollTop() >= topBlog) {
    menuAll;
    $('#menu a:contains("Blog")').addClass('active');
  } else if ($(window).scrollTop() >= topPort) {
    menuAll;
    $('#menu a:contains("Portfolio")').addClass('active');
  } else if ($(window).scrollTop() >= topAbout) {
    menuAll;
    $('#menu a:contains("About")').addClass('active');
  }
}

$(document).ready(function(){
  var menu = $('#menu');
  $('.icon').click(function() {
    menu.toggleClass('on').toggleClass('off');
  });
  
  var menuItem = $('#menu a');
  menuItem.click(function() {
    if (!$(this).hasClass('active')) {
      menuItem.removeClass('active');
      $(this).addClass('active');
    }
  });
  
  secHeight();
  
  if ($('.icon').css('display') == 'none') {
    $('#menu').removeClass('off').removeClass('on');
  } else if ($('.icon').css('display') == 'block' && !$('#menu').is('.off, .on')) {
    $('#menu').addClass('off');
  } 
});

$(window).resize(function(){
  secHeight();
  if ($('.icon').css('display') == 'none') {
    $('#menu').removeClass('off').removeClass('on');
  } else if ($('.icon').css('display') == 'block' && !$('#menu').is('.off, .on')) {
    $('#menu').addClass('off');
  } 
});

$(window).scroll(function() {
  mClose(); mSection();
});

$(document).mouseup(function(e) {
  var container = $('#menu');
  
  if (!container.is(e.target) && container.has(e.target).length === 0 && container.hasClass('on') && !$('.icon').is(e.target)) {
    container.addClass('off').removeClass('on');
  }
});
              
            
!
999px

Console