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

              
                <body>
  <form>
    <!-- Trunk -->
    <fieldset class="root show">
      <input class="name" type="text" placeholder="Full Name">
      <input class="phone" type="text" placeholder="Phone Number">
      <input class="email" type="text" placeholder="Email Address">
    </fieldset> 

    <!-- Get more information -->
    <fieldset class="branch more-info">
      <input class="best-contact" type="text" placeholder="How should we contact you?">
      <input class="best-time" type="text" placeholder="Best time to call?">
      <textarea class="message" placeholder="Your message"></textarea>
    </fieldset>

    <!-- Schedule a showing -->
    <fieldset class="branch showing">
      <input class="date1" type="text" placeholder="First choice date">
      <input class="date2" type="text" placeholder="Second choice date">
      <input class="time" type="text" placeholder="Time">
    </fieldset>

    <!-- Send to a friend -->
    <fieldset class="branch friend">
      <input class="friend-email" type="text" placeholder="Your friend's email">
      <textarea class="message" placeholder="Your message"></textarea>
    </fieldset>

    <!-- Get my home's value -->
    <fieldset class="branch home-value">
      <input class="prop-type" type="text" placeholder="Property type">
      <input class="city" type="text" placeholder="City/Area">
      <input class="bedrooms" type="text" placeholder="Bedrooms">
      <input class="bathrooms" type="text" placeholder="Bathrooms">
      <input class="size" type="text" placeholder="Size (Square Ft.)">
      <input class="value" type="text" placeholder="Estimated Value">
      <input class="time-frame" type="text" placeholder="Time Frame">
    </fieldset>

    <!-- Find a different home -->
    <fieldset class="branch find-home">
      <input class="prop-type" type="text" placeholder="Property type">
      <input class="city" type="text" placeholder="City/Area">
      <input class="bedrooms" type="text" placeholder="Bedrooms">
      <input class="bathrooms" type="text" placeholder="Bathrooms">
      <input class="size" type="text" placeholder="Size (Square Ft.)">
      <input class="price" type="text" placeholder="Price range">
      <input class="time-frame" type="text" placeholder="Time frame">
      <input class="relocating" type="text" placeholder="Are you relocating?">
    </fieldset>

    <!-- Fork -->
    <nav class="fork">
      <button class="show button more-info-button" type="button">Get More Information</button>
      <button class="show button showing-button" type="button">Schedule A Showing</button>
      <button class="show button friend-button" type="button">Send To A Friend</button>
      <button class="show button home-value-button" type="button">Get My Home's Value</button>
      <button class="show button find-home-button" type="button">Find A New Home</button>
    </nav>

    <!-- Main Navigation -->
    <nav class="main show">
      <button class="show prev" type="button">Prev</button>
      <button class="show next" type="button">Next</button>
    </nav>

    <input class="submit" type="submit" value="Submit">
  </form>  
</body>
              
            
!

CSS

              
                @import "compass/css3";

// Variables
$off-white: #ededed;
$gray: #bdc3c7;
$dark-gray: #bdc3c7;
$green: #1abc9c;
$red: #e74c3c;
$blue: #3498db;
$purple: #9b59b6;
$dark-blue: #34495e;



html, body{
  height: 100%;
}

form{
  position: relative;
  width: 80vw;
  top: 50%;
  transform: translateY(-50%);  
  margin: 0 auto;
  padding: 1.5em;
  background: $off-white;
  border-radius: 3px;
  overflow: hidden;
  transition: all 0.25s;
  
  fieldset{
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    display: none;
    
    input{
      float: left;
      width: calc(100% - 1.5em);
      margin: 1.5em 0 0 0;
      padding: 0.75em;
      border: 1px solid $off-white;
      background: white;
      color: shade($dark-gray, 30%);
      font-size: 16px;
      border-radius: 3px;
    }

    textarea{
      float: left;
      width: calc(100% - 1.5em);
      margin: 1.5em 0 0 0;
      padding: 0.75em;
      border: 1px solid $off-white;
      color: shade($dark-gray, 30%);
      font-size: 16px;
      border-radius: 3px;
      height: 8em;
      background: white;
    }
    
    .valid{
      border: 1px solid $green;
    }
    
    .error{
      border: 1px solid $red;
    }
        
    .active{
      background: $blue;
    }
  }

  fieldset:first-of-type{
    margin-top: 0;
  }

  button{
    width: 33.333%;
    margin: 1.5em 0 0 0;
    padding: 1em;       
    border: 0;
    background: $blue;
    color: white;
    font-size: 16px;
    border-radius: 3px;
    transition: all 0.25s;
    display: none;
  }  

  .prev{
    float: left;
  }

  .next{
    float: right;
  }

  button:hover{
    background: tint($blue, 15%);
  }

  button:disabled{
    background: $dark-gray;
  }

  .submit{
    @extend button;
    @extend .next;
    background: $green;
  }

  .submit:hover{
    background: tint($green, 15%);
  }

  .fork{
    button{
      width: 100%;
    }
  }

  .branch{
    display: none;
  }

  .show{
    display: block;
  }

  nav{
    display: none;
  }
}
              
            
!

JS

              
                $( document ).ready(function() {

	var controls = {
		$prev: $(".prev"),
		$next: $(".next"),
		$submit: $(".submit"),
		nav: {
			$button: $(".button"),
			$moreInfoButton: $(".more-info-button"),
			$showingButton: $(".showing-button"),
			$friendButton: $(".friend-button"),
			$homeValueButton: $(".home-value-button"),
			$findHomeButton: $(".find-home-button")
		}
	}
  
  controls.$prev.prop("disabled", true);
  controls.$next.prop("disabled", false);

	var tree = {
		$root: $(".root"),
		$fork: $(".fork"),
		branches: {
			$branch: $(".branch"),
			$moreInfo: $(".more-info"),
			$showing: $(".showing"),
			$friend: $(".friend"),
			$homeValue: $(".home-value"),
			$findHome: $(".find-home")
		}
	}

	var states = {
		pos: 0,

		next: 
			controls.$next.on("click", function(){
				tree.$root.addClass("fade");
				tree.$root.removeClass("show");
				tree.$fork.addClass("show");
				controls.$prev.prop("disabled", false);
				controls.$next.prop("disabled", true);
				states.pos++;
			}),

		prev: 
			controls.$prev.on("click", function(){
				if(states.pos === 1){
					tree.$fork.removeClass("show");
					tree.$root.addClass("show");
					controls.$prev.prop("disabled", true);
					controls.$next.prop("disabled", false);
			  	} 
				else if(states.pos === 2){
					controls.$next.addClass("show");
					tree.$fork.addClass("show");
					tree.branches.$branch.removeClass("show");
					controls.$submit.removeClass("show");
				}
				else{
					tree.$fork.addClass("show");
					tree.branches.$branch.removeClass("show");
				}
				states.pos--;
			}),

		button: 
			controls.nav.$button.on("click", function(){
				controls.$next.removeClass("show");
				controls.$submit.addClass("show");
			}),

		moreInfo: 
			controls.nav.$moreInfoButton.on("click", function(){
				tree.$fork.removeClass("show");
				tree.branches.$moreInfo.addClass("show");
				states.pos++;
			}),

		showing:
			controls.nav.$showingButton.on("click", function(){
				tree.$fork.removeClass("show");
				tree.branches.$showing.addClass("show");
				states.pos++;
			}),

		friend:
			controls.nav.$friendButton.on("click", function(){
				tree.$fork.removeClass("show");
				tree.branches.$friend.addClass("show");
				states.pos++;
			}),

		homeValue:
			controls.nav.$homeValueButton.on("click", function(){
				tree.$fork.removeClass("show");
				tree.branches.$homeValue.addClass("show");
				states.pos++;
			}),

		findHome:
			controls.nav.$findHomeButton.on("click", function(){
				tree.$fork.removeClass("show");
				tree.branches.$findHome.addClass("show");
				states.pos++;
			})
	}
});
              
            
!
999px

Console