h1.front-text.text-white Contact Form Dialog
h2.front-text.text-white Concept Design
label.btn-open(for="frmContactForm")
  i.far.fa-envelope
  span.ml-half Open Form
input(type="checkbox")#frmContactForm
.contact-modal
  .contact-form
    form
      .contact-wrapper
        .contact-section
          h2.p-none.m-none.mb-quarter.text-white
            i.far.fa-envelope
            span.ml-half Contact Me
        .contact-section
          .form-item
            input#txtFullName(type="text" placeholder="Full Name (Optional)")
            label.lbl-floating(for="txtFullName") Full Name (Optional)
            i.icon.text-white.fas.fa-user
          .form-item
            input#txtEmail(type="email" placeholder="E-Mail Address")
            label.lbl-floating(for="txtEmail") E-Mail Address
            i.icon.text-white.fas.fa-at
          .form-item
            textarea#txtContent(placeholder="Your message to the developer" rows="5")
            label.lbl-floating(for="txtContent") Your message to the developer
            i.icon.text-white.far.fa-comment
        .contact-section.text-right
          label(for="frmContactForm").contact-cancel
            i.fas.fa-times-circle
            span.ml-quarter Cancel
          button(type="button").btn-open.ml-whole
            i.far.fa-paper-plane
            span.ml-half Send
View Compiled
@import url("https://fonts.googleapis.com/css?family=Lato:400,400i,700");

body {
  font-size: 20px;
  font-family: Lato, sans-serif;
  background-image: linear-gradient(45deg, #6015ab, #ffaf19);
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.front-text {
  text-align: center;
  text-shadow: 0 0.15em 0.3em rgba(#000000, 0.5);
  padding: 0;
  margin: 0 0.5em 0.5em;
  filter: drop-shadow(0, 0, 0.1em, #000000);
  &:last-child {
    margin: 0;
  }
}

.btn-open {
  color: #ffffff;
  font-size: 1.25em;
  font-family: inherit;
  background-color: #4826ff;
  padding: 0.5em 1em;
  border: 0;
  outline: 0;
  margin-top: 0.5em;
  border-radius: 1.1em / 50%;
  box-shadow: 0 0.1em 0.3em rgba(#000000, 0.5), 0 -0.5em 1em rgba(#000000, 0.4) inset;
  transition: box-shadow 32ms ease-out, color 32ms ease-out;
  cursor: pointer;
  &:active {
    color: #dadada;
    box-shadow: 0 0 0 rgba(#000000, 0.5), 0 1em 2em rgba(#000000, 0.5) inset;
  }
}

#frmContactForm {
  display: none;
  &:checked + .contact-modal {
    width: 100vw;
    height: 100vh;
    opacity: 1;
    overflow: auto;
    transition:
      opacity 160ms ease-out,
      width 0ms ease-out,
      height 0ms ease-out;
    .contact-form {
      animation: contact-form-show 160ms ease-out;
    }
  }
}

@keyframes contact-form-show {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.contact-modal {
  font-size: 16px;
  width: 0;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0;
  transition:
    opacity 160ms ease-out,
    width 0ms ease-out 160ms,
    height 0ms ease-out 160ms;
}

.contact-form {
  background-color: rgba(#000000, 0.45);
  width: calc(100vw - 2em);
  max-width: 480px;
  padding: 1.5em 2em;
  margin: 2em;
  border-radius: 1.5em;
  box-shadow: 0 2em 3em rgba(#000000, 0.5);
  box-sizing: border-box;
  backdrop-filter: blur(0.4em);
}

.contact-wrapper {
  display: flex;
  flex-direction: column;
}

.contact-section {
  padding-bottom: 1.5em;
  box-sizing: border-box;
  &:last-child {
    padding-bottom: 0;
  }
}

.contact-cancel {
  color: #ffffff;
  cursor: pointer;
  &:hover {
    text-decoration: underline;
  }
}

.text-right {
  text-align: right;
}

.text-white {
  color: #ffffff;
}

.p-none {
  padding: 0;
}

.m-none {
  margin: 0;
}

.mb-whole {
  margin-bottom: 1em;
}

.ml-whole {
  margin-left: 1em;
}

.mb-half {
  margin-bottom: 0.5em;
}

.ml-half {
  margin-left: 0.5em;
}

.mb-quarter {
  margin-bottom: 0.25em;
}

.ml-quarter {
  margin-left: 0.25em;
}

.form-item {
  width: 100%;
  margin-bottom: 1em;
  position: relative;
  input[type="text"], input[type="email"], textarea {
    color: #ffffff;
    font-family: inherit;
    font-size: inherit;
    background-color: rgba(#000000, 0.5);
    width: 100%;
    padding: 1.8em 1em 0.8em 2.5em;
    border: 0;
    border-radius: 0.75em;
    outline: 0;
    margin: 0;
    box-sizing: border-box;
    &::placeholder {
      color: transparent;
    }
    &:not(:placeholder-shown) + label {
      font-size: 0.8em;
      top: 0.65em;
      left: 1em;
    }
  }
  i.icon {
    position: absolute;
    top: 1.8em;
    left: 1em;
  }
  label.lbl-floating {
    color: #c2c2c2;
    position: absolute;
    top: 1.8em;
    left: 2.5em;
    pointer-events: none;
    transition: font-size 64ms ease-out, top 64ms ease-out, left 64ms ease-out;
  }
}
View Compiled

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css

External JavaScript

This Pen doesn't use any external JavaScript resources.