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

Auto Save

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

              
                <div id="content">
  
  <div class="welcome">

    <h1 class="fade">a form for this section</h1>
    <button type="button" class="fade show btn">Show me the form</button>
  </div>
  
  <div class="content">
    <p>
      I made this to display some functionality I put together for a recent project.
    </p>
    
    <p>This uses jQuery to match a hidden form to the height of a welcome section.</p>
    
  </div>
  
</div>

<div id="form">
  <h2>
    Feed me your email!
  </h2>
  <form>
     <input type="text" placeholder="Your Email">
     <input type="submit">
   </form>
  <button class="btn close">Close</button>
</div>
              
            
!

CSS

              
                body{
  font-family: helvetica;
  margin: 0;
  position: relative;
  min-height: 600px;
  text-align: center;
  font-size: 100%;
  color: #3e4651;
}


.welcome{
  padding: 4em 1em;
  background-color: #00b5b5;
  h1{
    margin: 0.5em 0;
    font-size: 3em;
    color: #fff;
  }
  .btn{
    background-color: transparent;
    border: 3px solid #fff;
    padding: 0.5em 2em;
    font-size: 1em;
    letter-spacing: 0.5px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    &:hover{
      background-color: #fff;
      color: #00b5b5;
    }
  }
}

.content{
  padding: 2em 1em;
  .btn{
    background-color: transparent;
    border: 3px solid #f1654c;
    padding: 0.5em 2em;
    font-size: 1em;
    letter-spacing: 0.5px;
    color: #f1654c;
    font-weight: 700;
    cursor: pointer;
    outline: none;
  }
}

#form{
  position: absolute;
  padding: 4em 1em;
  box-sizing: border-box;
  display: none;
  color: #fff;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(62,70,81,1);
  h2{
    font-size: 2em;
    margin: 0.5em;
  }
  .btn{
    position: absolute;
    top: 2em;
    right: 3em;
    background-color: transparent;
    border: 0;
    color: #768395;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    outline: none;
    &:hover{
      color: #fff;
    }
    &:after{
      content: "+";
      color: #fff;
      display: inline-block;
      position: absolute;
      top: -0.33em;
      right: -0.8em;
      font-size: 2.4em;
      -webkit-transform: rotate(45deg);
       -moz-transform: rotate(45deg);
         -o-transform: rotate(45deg);
            transform: rotate(45deg);
    }
  }
  input[type=text]{
    color: #00b5b5;
    border: 2px solid #fff;
    padding: 0.3em 1em;
    font-size: 1.2em;
    font-weight: 700;
  }
  input[type=submit]{
    background-color: transparent;
    border: 3px solid #f1654c;
    padding: 0.5em 2em;
    font-size: 1em;
    letter-spacing: 0.5px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    &:hover{
      background-color: #f1654c;
      color: #fff;
    }
  }
}


              
            
!

JS

              
                $(document).ready(function(){
   
  var formHeight = $('.welcome').outerHeight();
  var welcomeHeight = $('.welcome').height();
  // Create function to have matched heights
  function getFormHeight(){
    $('.welcome').css("height", welcomeHeight);
    $('#form').css("min-height", formHeight);
  }
  
  function changeWelcomeHeight(){
    var newWelcomeHeight = $('#form').height();
  }
  
  // Run our function to get heights
  getFormHeight();
  
  // Fade and Show elements when 'share your ideas' button clicked
  $('.show').on('click', function(){
    $('.fade').fadeOut("slow");
    $('#form').delay(300).fadeIn("slow");
  });
  
  // Fade and Show elements when 'close' button clicked
  $('.close').on('click', function(){
    $('#form').fadeOut("slow");
    $('.fade').fadeIn("slow");
  });
  
  $( window ).resize(function() {
     if ( $('#form').css('display') != 'none' ) {
		changeWelcomeHeight();
     }
	});

});
 

              
            
!
999px

Console