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

              
                #app
  form
    .input-wrapper
      .input
        input(type="email" id="email" pattern=".{1,}" required placeholder=" ")
        label Email Address
      .alert
        p invalid email address
    button#submit-button(type="submit") SUBMIT
              
            
!

CSS

              
                body
  display: grid
  place-items: center center
  height: 100vh
  background-color: #F2C22B

.input-wrapper
  position: relative
  margin-bottom: 12px
  transition: margin 300ms ease-in-out
  
  .input
    position: relative
    background-color: white
    z-index: 1
    border-radius: 6px
    border: 1px solid #D5DBDB
  
  .alert
    position: absolute
    z-index: 0
    top: calc(100% - 5px)
    left: 0
    padding: 7px 6px 4px 6px
    font-size: 10px
    border: 1px solid red
    border-top: 0
    width: 100%
    border-radius: 0 0 6px 6px
    background-color: #FADBD8
    color: red
    transform: translateY(-100%)
    opacity: 0
    transition: all 300ms ease-out

    p
      margin: 0
  
  input, label
    font-size: 20px
    border: 0 solid

  input
    position: relative
    padding: 18px 10px
    border-color: #D5DBDB
    background-color: transparent
    z-index: 1

    &:focus + label
      transform: scale(0.5)
      top: 6px

    &:not(:placeholder-shown) + label
      transform: scale(0.5)
      top: 6px

  label
    position: absolute
    top: 18px
    left: 10px
    border-color: transparent
    color: #D5DBDB
    z-index: 0
    transition: all 300ms ease-out
    width: 100%
    transform-origin: top left

  &.alert
    margin-bottom: 30px
    .input
      border-radius: 6px 6px 0 0
      border-bottom: 1px solid red
    .alert
      opacity: 1
      transform: translateY(0)

button
  display: block
  background-color: #212F3C
  padding: 18px 10px
  color: white
  width: 100%
  border-radius: 6px
  font-size: 20px
  font-family: 'Helvetica', Arial, sans-serif
              
            
!

JS

              
                window['submit-button'].addEventListener('click', e => {
  e.preventDefault()
  if (!window.email.checkValidity()) {
    document.querySelector(".input-wrapper").classList.add("alert")
  } else {
    document.querySelector(".input-wrapper").classList.remove("alert")
  }
})
              
            
!
999px

Console