실전퍼블리싱(로그인 화면)

Dev_Go·2022년 7월 19일
0
post-thumbnail

로그인 화면


폼 관련 가상클래스를 활용한 로그인 화면 만들기

예제보기

HTML

  <form class="login">
    <span>Email</span>
    <input type="email" placeholder="Email Address">
    <span>Password</span>
    <input type="password" placeholder="Password">
    <p>
      <label>
        <input type="checkbox">Keep me logged in
      </label>
      <a href="javascript:viod(0)">Forgot Your Password?</a>
    </p>
    <button>Log in</button>
  </form>

CSS

/* Google Web Font */
@import url('https://fonts.googleapis.com/css?family=Montserrat:300,400,500&display=swap');

body {
  font-family: 'Montserrat', sans-serif;
  line-height: 1.5em;
  margin: 0;
  font-weight: 300;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: #222;
}
a {
  text-decoration: none;
  color: #222;
}

.login {
  width: 800px;
  background-color: #f5f5f5;
  border: 1px solid #eee;
  border-radius: 5px;
  padding: 25px;
  box-sizing: border-box;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.2);
}
.login span {
  font-weight: bold;
  display: block;
  margin-top: 20px;
}
.login input[type=email],
.login input[type=password] {
  width: 100%;
  padding: 15px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 5px;
  outline: none;
  transition: 0.3s;
  padding-left: 50px;
}
.login input[type=email]:hover,
.login input[type=password]:hover {
  border: 1px solid dodgerblue;
  box-sizing: 0 0 5px dodgerblue;
}
.login input[type=email] {
  background: #fff url('../images/icon-email.png') no-repeat center left 10px;
}
.login input[type=password] {
  background: #fff url('../images/icon-lock.png') no-repeat center left 10px;
}
.login input[type=email]::placeholder,
.login input[type=password]::placeholder {
  opacity: 1;
  transition: 0.3s;
}
.login input[type=email]:focus::placeholder,
.login input[type=password]:focus::placeholder {
  opacity: 0;
  visibility: hidden;
}

.login p {
  overflow: hidden;
}
.login p label {
  float: left;
  cursor: pointer;
}
.login p a {
  float: right;
}
.login p a:hover {
  text-decoration: underline;
}
.login button {
  background-color: #2991b1;
  color: #fff;
  width: 300px;
  height: 50px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 20px;
  transition: 0.3s;
}
.login button:hover {
  background-color: #2c778e;
}
profile
프론트엔드 4년차

0개의 댓글