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

              
                <form autocomplete="off">
  <div id="focus"></div>
  <h1>Your info</h1>
  <input type="text" half placeholder="First name" autocomplete="no">
  <input type="text" half placeholder="Last name" autocomplete="no">
  <input type="text" placeholder="Address" autocomplete="no">
  <input type="text" half placeholder="Zip code" autocomplete="no">
  <input type="text" half placeholder="City" autocomplete="no">
  <input type="text" placeholder="Mail" autocomplete="no">
  <input type="submit" value="Send it">
</form>
              
            
!

CSS

              
                *{
  margin:0;
  padding:0;
  box-sizing:border-box;
  font-family: 'Poppins', sans-serif;
}
body{
  height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
}
form{
  border:2px solid #D09B52;
  padding:40px 10px 0px 40px;
  width:70%;
  max-width:700px;
  border-radius:20px;
}
#focus{
  border:3px solid #fef6fb;
  box-shadow:0 0 10px 0 #D09B52;
  position:absolute;
  transition:
    width .2s ease, 
    height .2s ease, 
    left .2s ease, 
    top .2s ease, 
    border-radius .2s ease;
  pointer-events:none;
  z-index:5;
  border-radius:10px;
  display:none;
}
h1{
  margin-bottom:30px;
  font-size:2em;
  color:#000;
}
input{
  padding:10px 15px;
  border-radius:10px;
  transition:.3s ease;
  color:#868283;
  
  &[type=text]{
    width:calc(100% - 30px);
    margin-bottom:30px;
    border:2px solid #868283;
    &:placeholder-shown{
      border:2px solid #EAE4DA;
    }
    &::placeholder{
      color:#A3A5AA;
    }
    &[half]{
      width:calc(50% - 30px);
      float:left;
      margin-right:30px;
    }
  }
  &[type=submit]{
    background:#D09B52;
    color:#EAE4DA;
    border:2px solid #D09B52;
    outline:10px solid #fff;
    width:calc(50% - 30px);
    height:40px;
    margin:0 30px -20px 0;
    float:right;
    font-weight:800;
    font-size:0.7em;
    letter-spacing:1.8pt;
    text-transform:uppercase;
    cursor:pointer;
    
    &:hover{
      outline-width:0;
    }
  }
  &:focus{
    outline:0;
  }
}
              
            
!

JS

              
                const FORM = $("form"); // set form or other element here
const TYPES = ["input[type=text], input[type=submit]"]; // set which elements get targeted by the focus
const FOCUS = $("#focus"); // focus element

// function for positioning the div
function position(e) {
  // get position
  var props = {
    top: e.offset().top,
    left: e.offset().left,
    width: e.outerWidth(),
    height: e.outerHeight(),
    radius: parseInt(e.css("border-radius"))
  };
  
  // set position
  FOCUS.css({
    top: props.top,
    left: props.left,
    width: props.width,
    height: props.height,
    "border-radius": props.radius
  });
  
  FOCUS.fadeIn(200);
}

FORM.find(TYPES.join()).each(function(i) {
  // when clicking an input defined in TYPES
  $(this).focus(function() {
    el = $(this);

    // adapt size/position when resizing browser
    $(window).resize(function() {
      position(el);
    });

    position(el);
  });
});

FORM.on("focusout", function(e) {
  setTimeout(function() {
    if (!e.delegateTarget.contains(document.activeElement)) {
      FOCUS.fadeOut(200);
    }
  }, 0);
});

              
            
!
999px

Console