Neumorphism Login Form with HTML & CSS

01/28/2021

Contents

Demo

Full Screen

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Neumorphism Login Form</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <div class="form-box">
        <div class="ic-account"></div>
        <form id="login-form" name="login-form" action="#" method="post">
          <input id="email" class="login-form-input" type="email" name="your-email" placeholder="Email Address" required>
          <input id="password" class="login-form-input" type="password" name="your-password" placeholder="Password" required>
          <button class="login-form-btn" type="submit">Login</button>
          <p class="text"><a href="#">Forgot password?</a> or <a href="#">Sign up</a>
        </form>
      </div>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #ecf0f3;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100vh;
  padding: 20px;
}
.form-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 300px;
  padding: 30px 20px;
  border-radius: 10px;
  box-shadow: -2px -2px 8px rgba(255, 255, 255, 1),
              -2px -2px 12px rgba(255, 255, 255, 0.5),
              inset 2px 2px 4px rgba(255, 255, 255, 0.1),
              2px 2px 8px rgba(0, 0, 0, .3);
  background-color: #ecf0f3;
}
.ic-account {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
  border-radius: 50%;
  box-shadow: -2px -2px 8px rgba(255, 255, 255, 1),
              -2px -2px 12px rgba(255, 255, 255, 0.5),
              inset 2px 2px 4px rgba(255, 255, 255, 0.1),
              2px 2px 8px rgba(0, 0, 0, .3);
  background-image: url(ic_account.svg);
  background-position: center;
  background-size: 40px;
  background-repeat: no-repeat;
  background-color: #ecf0f3;
}
.login-form-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin: 10px auto;
  padding: 15px 20px;
  border: none;
  border-radius: 23px;
  box-shadow: inset -2px -2px 8px rgba(255, 255, 255, 1),
              inset -2px -2px 12px rgba(255, 255, 255, 0.5),
              inset 2px 2px 4px rgba(255, 255, 255, 0.1),
              inset 2px 2px 8px rgba(0, 0, 0, .3);
  background-color: #ecf0f3;
  font-size: 1rem;
  outline: none;
}
.login-form-input::placeholder {
  color: #5c5c5c;
}
.login-form-btn {
  width: 100%;
  height: 50px;
  margin-top: 20px;
  margin-bottom: 10px;
  padding: 15px;
  border: none;
  border-radius: 25px;
  box-shadow: -2px -2px 8px rgba(255, 255, 255, 1),
              -2px -2px 12px rgba(255, 255, 255, 0.5),
              inset 2px 2px 4px rgba(255, 255, 255, 0.1),
              2px 2px 8px rgba(0, 0, 0, .3);
  color: #f252a5;
  font-size: 20px;
  background-color: #ecf0f3;
  outline: none;
  cursor: pointer;
}
.login-form-btn:hover {
  transform: scale(0.98);
  box-shadow: inset -2px -2px 8px rgba(255, 255, 255, 1),
              inset -2px -2px 12px rgba(255, 255, 255, 0.5),
              inset 2px 2px 4px rgba(255, 255, 255, 0.1),
              inset 2px 2px 8px rgba(0, 0, 0, .3);
}
.text {
  margin: 0;
  padding: 0;
  color: #5c5c5c;
  font-size: 14px;
  text-align: center;
}
.text a {
  color: #5c5c5c;
}
@media screen and (max-width: 480px) {
  #container {
    height: auto;
    align-items: flex-start;
  }
}