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

              
                <header>
  <div class="container">
      <a href="#home" class="logo">Fixed Responsive Nav</a>
      <nav class="nav-collapse">
        <ul>
          <li class="menu-item active"><a href="#home">Home</a></li>
          <li class="menu-item"><a href="#about">About</a></li>
          <li class="menu-item"><a href="#projects">Projects</a></li>
          <li class="menu-item"><a href="#blog">Blog</a></li>
        </ul>
      </nav>
    </div>
  </header>
  <div class="container container-bottom">
  <section>
      <h2>Section One</h2>
      <img src="http://placehold.it/900x600/23263c/FFFFFF">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae deleniti enim fuga numquam possimus officia reprehenderit autem quam, natus temporibus molestias magnam laborum facilis, corporis ullam iusto dignissimos beatae sapiente!</p>
   
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore consequuntur autem, recusandae, repellendus similique culpa necessitatibus provident! Eaque nobis, itaque aut, atque praesentium corrupti aliquam pariatur quos debitis modi sunt!</p>
    </section>

    <section>
      <h2>Section Two</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Delectus beatae inventore cupiditate itaque vero voluptatum omnis ducimus laudantium accusantium quibusdam, asperiores architecto blanditiis esse id, deserunt nulla earum dolorum ab.</p>
      <img src="http://placehold.it/900x600/575BEE/FFFFFF">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ea molestias saepe qui nemo consequuntur impedit ullam rerum pariatur enim natus aperiam velit ab accusamus doloremque consequatur aliquam, iusto, facere non!</p>
    </section>

    <section>
      <h2>Section Three</h2>
      <img src="http://placehold.it/900x600/16C72B/FFFFFF">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui commodi minus atque, numquam velit, cum culpa voluptatum modi ab, eaque corporis! Ratione consequatur, omnis, odio quod nemo nobis eius? Asperiores.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Facere, molestiae velit sit quasi animi fugiat eius vitae, fuga reprehenderit sequi iste tenetur nobis delectus ullam maiores deleniti accusamus blanditiis natus.</p>
    </section>

    <section>
      <h2>Section Four</h2>
      <img src="http://placehold.it/900x600/CD0A0A/FFFFFF">
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi culpa, incidunt optio consequatur eius at voluptatibus beatae expedita blanditiis, magnam perspiciatis rem unde ad sequi ab velit pariatur facilis assumenda.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ex officia quia, ducimus harum voluptatem consequuntur sequi, enim iste provident, necessitatibus, voluptatibus molestias! Quia eligendi ipsum nihil commodi odit illo quas.</p>
    </section>
  </div>
              
            
!

CSS

              
                /* =============================================
 *
 *   FIXED RESPONSIVE NAV
 *
 *   Credit: 
 *   http://viljamis.com/ ( JS Plugin)
 *   http://www.adtile.me/ (Fixed example)
*    https://fortawesome.github.io/Font-Awesome/ (Icon font)
 *
 *   Free to use under the MIT License.
 *
 * ============================================= */

body, div,
h1, h2, h3, h4, h5, h6,
p, blockquote, pre, dl, dt, dd, ol, ul, li, hr,
fieldset, form, label, legend, th, td,
article, aside, figure, footer, header, hgroup, menu, nav, section,
summary, hgroup {
  margin: 0;
  padding: 0;
  border: 0;
}

a:active,
a:hover {
  outline: 0;
}

@-webkit-viewport { width: device-width; }
@-moz-viewport { width: device-width; }
@-ms-viewport { width: device-width; }
@-o-viewport { width: device-width; }
@viewport { width: device-width; }


/* ------------------------------------------
  RESPONSIVE NAV STYLES
--------------------------------------------- */

.nav-collapse ul {
  margin: 0;
  padding: 0;
  width: 100%;
  display: block;
  list-style: none;
}

.nav-collapse li {
  width: 100%;
  display: block;
}

.js .nav-collapse {
  clip: rect(0 0 0 0);
  max-height: 0;
  position: absolute;
  display: block;
  overflow: hidden;
  zoom: 1;
}

.nav-collapse.opened {
  max-height: 9999px;
}

.disable-pointer-events {
  pointer-events: none !important;
}

.nav-toggle {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;
}

@media screen and (min-width: 768px) {
  .js .nav-collapse {
    position: relative;
  }
  .js .nav-collapse.closed {
    max-height: none;
  }
  .nav-toggle {
    display: none;
  }
}


/* ------------------------------------------
  FIXED HEADER
--------------------------------------------- */

header {
  position: fixed;
  z-index: 3;
  width: 100%;
  left: 0;
  top: 0;
}

.logo {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  text-decoration: none;
  font-weight: bold;
  line-height: 55px;
  padding: 0;
  color: #000;
  float: left;
}


/* ------------------------------------------
  MASK
--------------------------------------------- */

.mask {
  -webkit-transition: opacity 300ms;
  -moz-transition: opacity 300ms;
  transition: opacity 300ms;
  background: rgba(0,0,0, .2);
  visibility: hidden;
  position: fixed;
  opacity: 0;
  z-index: 2;
  bottom: 0;
  right: 0;
  left: 0;
  top: 0;
}

.android .mask {
  -webkit-transition: none;
  transition: none;
}

.js-nav-active .mask {
  visibility: visible;
  opacity: 1;
}

@media screen and (min-width: 768px) {
  .mask {
    display: none !important;
    opacity: 0 !important;
  }
}


/* ------------------------------------------
  NAVIGATION STYLES
--------------------------------------------- */

.fixed {
  position: fixed;
  width: 100%;
  left: 0;
  top: 0;
}

.nav-collapse,
.nav-collapse * {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.nav-collapse,
.nav-collapse ul {
  list-style: none;
  width: 100%;
  float: left;
}

@media screen and (min-width: 768px) {
  .nav-collapse {
    float: right;
    width: auto;
  }
}

.nav-collapse li {
  float: left;
  width: 100%;
}

@media screen and (min-width: 768px) {
  .nav-collapse li {
    width: auto;
  }
}

.nav-collapse a {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  text-decoration: none;
  padding: 0.7em 1em 0.7em 0;
  color: #000;
  width: 100%;
  float: left;
}

.nav-collapse a:active,
.nav-collapse .active a {
  text-decoration: underline;
}

@media screen and (min-width: 768px) {
  .nav-collapse a {
    padding: 1.02em 2em;
    text-align: center;
    border-top: 0;
    float: left;
    margin: 0;
  }
  
  .nav-collapse:last-child a {
    padding-right: 0;
  }
}

.nav-collapse ul ul a {
  background: #ca3716;
  padding-left: 2em;
}

@media screen and (min-width: 768px) {
  .nav-collapse ul ul a {
    display: none;
  }
}


/* ------------------------------------------
  NAV TOGGLE STYLES
--------------------------------------------- */

.nav-toggle {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-decoration: none;
  text-indent: -300px;
  position: relative;
  overflow: hidden;
  width: 60px;
  height: 55px;
  float: right;
}

.nav-toggle:before {
  color: #000; /* Edit this to change the icon color */
  font: normal 28px/55px "FontAwesome"; /* Edit font-size (28px) to change the icon size */
  text-transform: none;
  text-align: right;
  position: absolute;
  content: "\f0c9"; /* Hamburger icon */
  text-indent: 0;
  speak: none;
  width: 100%;
  left: 0;
  top: 0;
}

.nav-toggle.active:before {
  font-size: 24px;
  content: "\f00d"; /* Close icon */
}

/* Demo style */

body {
  font-family: 'Open Sans', sans-serif;
  background: #eee;
}

img {
  max-width: 100%;
  padding: 0 0 20px 0; 
}

h2 {
  padding-bottom: 20px;
}

header {
  background: #FFF;
  opacity: 0.8;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding-left: 15px;
  padding-right: 15px;
}

.container-bottom {
  margin-top: 80px;
}

section {
  padding-bottom: 30px;
}

section p {
  padding-bottom: 20px;
}
              
            
!

JS

              
                var nav = responsiveNav(".nav-collapse");
              
            
!
999px

Console