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

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

              
                <body id="top">
  <div id="header">
    <a href="#"><img src="http://media.mediatemple.netdna-cdn.com/wp-content/themes/smashing-magazine/assets/images/logo.png" alt="Smashing Magazine Logo" /></a>
  </div>
  <div id="mobile-nav-toggle-buttons">
    <a class="nav-toggle-button" href="#mobile-navigation">Menu</a>
    <a class="search-toggle-button" href="#mobile-search">Search</a>
  </div>
  <div id="mobile-navigation">
    <a class="close-that-nav" href="#top">×</a>
    <nav role="navigation" class="cf">
      <ul>
        <li>Smashing Pages</li>
        <li><a href="#">Nav Item One</a></li>
        <li><a href="#">Nav Item Two</a></li>
        <li><a href="#">Nav Item Three</a></li>
        <li><a href="#">Nav Item Four</a></li>
      </ul>
      <ul>
        <li>Smashing Categories</li>
        <li><a href="#">Nav Item Five</a></li>
        <li><a href="#">Nav Item Six</a></li>
        <li><a href="#">Nav Item Seven</a></li>
        <li><a href="#">Nav Item Eight</a></li>
      </ul>
    </nav>
  </div>
  <div id="mobile-search">
    <a class="close-that-search" href="#top">×</a>
    <form>
      <label for="mobile-search-input">Search on Smashing Magazine</label>
      <input id="mobile-search-input" type="text" />
      <button type="submit">Search</button>
    </form>
  </div>
</body>
              
            
!

CSS

              
                /** Creating something like a browser window **/
html {
  background: gray;
}

body {
  font-family: sans-serif;
  font-size: 1em;
  line-height: 1.46;
  position: relative;
  background: url("http://media.mediatemple.netdna-cdn.com/wp-content/themes/smashing-magazine/assets/images/smbg.png");
  max-width: 800px;
  margin: 0 auto;
  padding: 1.618em 1em;
}

a { text-decoration: none }

.cf::after,
.cf::before {
  content: " ";
  display: table;
}
.cf::after {
  clear: both;
}

/** Styling the header **/
#header {
  position: relative;
  max-width: 61.8%;
  z-index: 2;
}

#mobile-nav-toggle-buttons {
  max-width: 38.2%;
  position: absolute;
  right: 1em;
  top: 2em;
  z-index: 2;
}
#mobile-nav-toggle-buttons a {
  text-transform: uppercase;
  text-align: center;
  color: white;
  float: right;
  margin-right: .75em;
  display: block;
  padding: .75em .5em .5em;
  border: .08em solid rgba(0,0,0,.1);
  outline: 0;
  overflow: hidden;
  border-radius: .25em;
  box-shadow: 0 .08em .08em rgba(0,0,0,.25);
  background: linear-gradient(to bottom, #E95C33 0px, #E53B2C 100%);
  transition: all .3s ease 0s;
}
    
#mobile-nav-toggle-buttons a.active {
  background: #bababa;
  cursor: default;
  box-shadow: 0 .08em .08em rgba(255,255,255,.65), 0 -.08em .08em rgba(255,255,255,.65);
}

#mobile-navigation,
#mobile-search {
  position: absolute;
  clear: both;
  display: none;
  width: 100%;
  padding: 0;
  top: 0;
  height: 0;
  transition: all 0.3s ease 0s;
}

#mobile-navigation:target,
#mobile-search:target {
  padding: 7em 0 0;
  top: -7em;
  z-index: 2;
  height: auto;
  position: relative;
  display: block;
  margin-bottom: -5em;
  z-index: 1;
}

[href="#top"] {
  display: block;
  position: absolute;
  top: 5.35em;
  right: .75em;
  float: right;
  z-index: 3;
  color: #505050;
  font-size: 1.5em;
  padding: .3425em .625em;
  background: transparent none repeat scroll 0% 0%;
  border: .08em solid rgba(0,0,0,.1);
  border-radius: .25em;
  box-shadow: 0 .08em .08em rgba(255,255,255,.7);
}

#mobile-search [href="#top"] {
  top: 5.65em;
}

form {
  position: relative;
  width: 80.9%;
  margin: 1.618em 0;
}

label {
  color: gray;
  display: block;
  padding-bottom: .5em;
}

input[type="text"] {
  font-size: 1em;
  color: #333;
  background-color: #FFF;
  outline: 0;
  width: 61.8%;
  margin: 0;
  border: .08em solid rgba(0,0,0,.1);
  border-right: 0;
  border-radius: .5em 0 0 .5em;
  margin-bottom: 0;
  padding: 0 0 0 .5em;
  height: 2.4em;
  transition: border-color .3s;
}

input[type="text"]:hover,
input[type="text"]:focus {
  border-color: rgba(0,0,0,.4);
}

button {
  font-size: 1em;
  color: white;
  padding: 0 .5em;
  position: absolute;
  top: 2em;
  width: 32.8%;
  line-height: 1.4;
  height: 2.5em;
  background: linear-gradient(to bottom, #E95C33 0px, #E53B2C 100%);
  border: .08em solid rgba(0,0,0,.4);
  border-radius: 0 .5em .5em 0;
}

nav ul {
  list-style: none;
  border-top: .08em solid rgba(0,0,0,.1);
  width: 38.2%;
  float: left;
  max-width: 18.75em;
  padding: 1em 0 0 0;
}

nav ul:nth-child(2) {
  margin-left: 5.5%;
}

nav ul li {
  line-height: 1.65;
  display: block;
  padding: .3275em;
  outline: 0;
  border-top: .08em solid rgba(0,0,0,.05);
  transition: all 0.3s ease 0s;
}

nav ul li:first-child {
  font-size: 1.25em;
  font-weight: bold;
  line-height: 1.45em;
  margin: .25em 0 .5em;
  border: 0;
}
  
nav ul li a {
  color: #41B7D8;
}
              
            
!

JS

              
                jQuery(document).ready(function() {
  jQuery( ".search-toggle-button" ).click(function() {
    jQuery(this).addClass( "active" );
    jQuery( ".nav-toggle-button" ).removeClass( "active" );
  });
  
  jQuery( ".nav-toggle-button" ).click(function(){
    jQuery(this).addClass( "active" );
    jQuery( ".search-toggle-button" ).removeClass( "active" );
  });
  
  jQuery( ".close-that-search" ).click(function(){
    jQuery( ".search-toggle-button" ).removeClass( "active" );
  });
  
  jQuery( ".close-that-nav" ).click(function(){
    jQuery( ".nav-toggle-button" ).removeClass( "active" );
  });
})
              
            
!
999px

Console