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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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 href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,500' rel='stylesheet' type='text/css'>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<div class='navbar purple'>
		<ul>
      <li><a href="#"><span class='fa fa-home'></span>Home</a></li>
			<li><a href="#"><span class='fa fa-file'></span>Resources</a></li>
			<li><a href="#"><span class='fa fa-wrench'></span>Tools</a></li>
			<li><a href="#"><span class='fa fa-list'></span>Examples</a></li>
			<li><a href="#"><span class='fa fa-tag'></span>Tags</a></li>
			<li><a href="#"><span class='fa fa-pencil'></span>Blog</a></li>	
		</ul>
	</div>
              
            
!

CSS

              
                body { background-color: #333; height: 2000px }

.navbar {
	height: 48px;
	width: 100%;
  margin-top: 40px;
  background-color: #222;
  background-image: linear-gradient(#333, #222);
	position: relative;
	border-top: 1px solid #444;
  border-bottom: 1px solid #555
}

.navbar ul {
	padding: 0;
	margin: 0 auto;
	width: 640px;
	height: 48px
}

.navbar ul li { float: left }
.navbar ul li a {
	color: #fff;
	display: inline-block;
	width: 105px;
	font: 
	normal normal 500 
	15px/48px 
	'Source Sans Pro', Arial, sans-serif;
	text-align: center;
	text-decoration: none;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 -1px rgba(143, 222, 98, .1);
  border-right: 1px solid #555;
  transition: color .2s ease-in-out;
  box-sizing: border-box
}
.navbar li:last-child a { border-right: 0 }

/* ADDS THIS CLASS ON SCROLL */
.fixed { position: fixed; top: 0; margin: 0 }

/* FONTAWESOME */
.fa { margin-right: 10px }

/* RESPONSIVE DESIGN */
@media screen and (max-width: 600px) {
  .navbar ul {
    width: 100%;
    display: block;
    height: auto
  }
  .navbar ul li {
    width: 50%;
    float: left;
    position: relative;
    background-color: #222;
    background-image: linear-gradient(#333, #222)
  }
  .navbar ul li a {
    text-align: left;
    width: 100%;
    padding-left: 25px;
    border-bottom: 1px solid #555;
		border-right: 1px solid #555
  }
}

/* COLORS */
.green a:hover { color: #8fde62 }
.blue a:hover { color: #3cf }
.red a:hover { color: #fc7171 }
.purple a:hover { color: #e25cf9 }
              
            
!

JS

              
                //CSS STICKY RESPONSIVE NAVIGATION

/* BROWSER COMPATILITY
--INTERNET EXPLORER 8+ (No Responsiveness in IE8)
--GOOGLE CHROME
--MOZILLA FIREFOX
--OPERA
--SAFARI
*/

$(function(){
  var nav = $(".navbar"),
      yOffset = 0,
      triggerPoint = 40;
  $(window).scroll(function(){
    yOffset = $(window).scrollTop();
    
    if(yOffset >= triggerPoint){
      nav.addClass("fixed");
    }else{
      nav.removeClass("fixed");
    }
    
  });
});
              
            
!
999px

Console