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

              
                <form action="#" method="post" class="fancy-form">

  <fieldset>
    <legend>Address</legend>
    <p class="instructions">Start by entering your zip code.</p>
    <div>
      <div>
        <input type="text" name="address-line-1" id="address-line-1">
        <label for="address-line-1">Street #1</label>
      </div>
    </div>
    <div>
      <div>
        <input type="text" name="address-line-2" id="address-line-2">
        <label for="address-line-2">Street #2</label>
      </div>
    </div>
    <div>
      <div class="city-wrap">
        <input type="text" name="city" id="city">
        <label for="city">City</label>
      </div>
      <div class="state-wrap">
        <input type="text" name="state" id="state">
        <label for="state">State</label>
      </div>
      <div class="zip-wrap">
        <input type="text" pattern="[0-9]*" maxlength="5" required name="zip" id="zip">
        <label for="zip">Zip</label>
        <p class="zip-error">Not a real zip code.</p>
      </div>
    </div>

    <div class="submit-wrap">
      <input type="submit" value="Submit">
    </div>

  </fieldset>

</form>
              
            
!

CSS

              
                body {
	font: 12px "Lucida Grande", serif;
}

.fancy-form {
	background: #f7f7f7;
	border-radius: 6px;
	padding: 20px;
	box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2), inset 0px 0px 0px 1px rgba(255, 255, 255, 1);
	border: 1px solid #B2B2B2;
}

.fancy-form input {
	transition: all 0.3s ease-out;
}

.fancy-form input[type="text"] {
	outline: none;
	border: 1px solid #cccccc;
	box-shadow: 0px 0px 0px 4px rgba(0, 0, 0, 0.1), inset 0px 1px 0px 0px rgba(255, 255, 255, 1), inset 0px 1px 6px 0px rgba(0, 0, 0, 0.05);
	border-radius: 3px;
	padding: 7px 10px;
	background: #f1f1f1;
	color: #b5b5b5;
	margin-bottom: 4px;
}

.fancy-form input[type="text"]:hover {
	background: #f7f7f7;
}

.fancy-form input[type="text"]:focus {
	box-shadow: 0px 0px 0px 5px rgba(0, 0, 0, 0.1), 0px 1px 5px 0px rgba(0, 0, 0, 0.2), inset 0px 1px 6px 0px rgba(0, 0, 0, 0.1);
	background: #fff;
	border-color: transparent;
	color: #565656;
}

.fancy-form fieldset {
	border: none;
	padding: 25px 10px 10px 10px;
}

.fancy-form legend {
	font: 26px "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	text-transform :uppercase;
	text-shadow: 0 1px 1px #fff;
	color: #1b6d8e;
	padding: 0 5px;
}

.fancy-form label {
	display: block;
	font: 14px Arial, Helvetica, sans-serif;
	padding-left: 10px;
	letter-spacing: 1px;
	padding-left: 10px;
	color: #1b6d8e;
	opacity: 0.8;
}
.fancy-form input:focus + label {
	opacity: 1.0;
}

.fancy-form input:not([type=submit]) {
	width: 100%;
	display: block;
}

.submit-wrap {
	display: none;
}

.fancy-form div {
	margin: 0 0 6px 0;
	clear: both;
}

.fancy-form div > div {
	padding: 4px;
}

.fancy-form .city-wrap {
	width: 69%;
	margin-right: 1%;
}

.fancy-form .state-wrap {
	width: 9%;
	margin-right: 1%;
}

.fancy-form .zip-wrap {
	width: 20%;
	display: block !important;
}

.zip-error {
	color: #d70000;
	font: 12px "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	border-top: 2px dotted #ec9696;
	border-bottom: 2px dotted #ec9696;
	text-align: center;
	padding: 5px 10px;
	margin-top: 10px;
	display: none;
}

              
            
!

JS

              
                function is_int(value) {
  if ((parseFloat(value) == parseInt(value)) && !isNaN(value)) {
    return true;
  } else {
    return false;
  }
}

$(".fancy-form div > div").hide();

$("#zip").keyup(function() {

  // Cache
  var el = $(this);

  // Did they type five integers?
  if ((el.val().length == 5) && (is_int(el.val()))) {

    // Call Ziptastic for information
    $.ajax({
      url: "https://zip.getziptastic.com/v2/US/" + el.val(),
      cache: false,
      dataType: "json",
      type: "GET",
      success: function(result, success) {

        $(".zip-error, .instructions").slideUp(200);

        $("#city").val(result.city);

        $("#state").val(result.state);

        $(".fancy-form div > div").slideDown();

        $("#zip").blur();
        $("#address-line-1").show().focus();

      },
      error: function(result, success) {

        $(".zip-error").slideDown(300);

      }

    });

  } else if (el.val().length < 5) {

    $(".zip-error").slideUp(200);

  };

});
              
            
!
999px

Console