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

              
                <button type="button" class="btn" id="c-btn">Open Contact Form</button>

<div id="contact">
  <form action="#">
    <ul>
      <h1>Contact</h1>
      <li>
        <input type="text" name="name" id="name" placeholder="&#xf2c0; Full name">
        <input type="email" name="email" id="email" placeholder="&#xf003; Email">
      </li>
      <li>
        <textarea name="message" id="message" placeholder="&#xf040; Your message"></textarea>
      </li>
      <li>
        <input type="submit" value="Send message" class="btn" id="submit">
      </li>
    </ul>
  </form>
</div>
              
            
!

CSS

              
                body {font-family: 'Source Sans Pro', sans-serif; background: #ffde66;}
*{margin:0;padding:0;}
textarea:focus, input:focus{outline: none;}
ul li {list-style: none;}
h1{font-weight: 800; text-transform: uppercase; color: #3333ff; font-size: 32px; width: 200px; text-align: center; margin: 30px 100px;}
ul {display: inline-block}

#contact {
    background: #fff;
    position: relative;
    width: 400px;
    margin: 0 auto;
    box-shadow: 0 10px 20px rgba(0,0,0,.1)
}

.js #contact {
    position: absolute;
    top: 3em;
    display: none;
    left:0; right:0;
}

input {
    border: 0;
    margin: 1em 40px;
    width: 300px;
    padding: 10px;
    border-bottom: 2px solid #3333ff;
    background: none;
    font-family: 'Fontawesome', 'Source Sans Pro', sans-serif;
    display: block;
    color: #3333ff;
}

textarea{
    border: 0;
    width: 300px;
    height: 100px;
    display: block;
    margin-left: 40px;
    background: none;
    padding: 10px;
    font-family: 'Fontawesome', 'Source Sans Pro', sans-serif;
    border-bottom: 2px solid #3333ff;
    color: #3333ff;
}

#submit {
  margin: 3em auto 4em;
  border: 2px solid #3333ff;
  color: #3333ff;
}
#submit:hover {color: #fff}

.btn{
    background: none;
    border: 2px solid #252525;
    box-shadow: 0 0 10px rgba(0, 0, 0, .1);
    margin: 15em auto;
    padding: 1.2em 2em;
    color: #212121;
    font-family: 'Open Sans';
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: ease all .3s;
    display: block;
}

.btn:hover{background: #3333ff; color: #fff; border: #3333ff solid 2px;}
.btn:active{background: #3333aa; color: #fff; border: #3333aa solid 2px;}

.close {
    position: absolute;
    right: 20px;
    top: -10px;
    cursor: pointer;
    font-weight: 400;
    font-size: 3em;
    color: #ee4444;
}
              
            
!

JS

              
                (function(){
  $('html').addClass('js');
  
  var contactForm = {
    container: $('#contact'),
    config: {
      effect: 'slideToggle',
      speed: 200
    },
    
    init: function(config){
      $.extend(this.config, config);
      
      $('#c-btn').on('click', this.show);
    },

    show: function(){
      var cf = contactForm,
          container = cf.container,
          config = cf.config;
                    

      if(container.is(':hidden')){
        cf.close.call(container);
        container[config.effect]
        (config.speed);
      }
    },

    close: function(){
      var $this = $('#contact'); 
      
      if($this.find('span.close').length) return;

      $('<span class=close>-</span>')
        .prependTo(this)
        .on('click', function(){
        $this[contactForm.config.effect](contactForm.config.speed);
      })
    }
  };

contactForm.init({
  effect: 'fadeToggle',
  speed: 200
});
})();
              
            
!
999px

Console