【CSS教程】紫色渐变登陆布局html+css代码

2023-03-21 20:51:54 浏览数 (1)

话不多说先上个图。本程序采用的效果全部是css编写

代码结构也很简单,有需要的小伙伴可以借鉴一下,下面放代码

HTML

代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="css/style.css">
  <title>Login</title>
</head>
<body>
  <div class="login-container">
    <div class="left-container">
      <div class="title"><span>登录</span></div>
      <div class="input-container">
        <input type="text" name="username" placeholder="用户名">
        <input type="password" name="password" placeholder="密码">
      </div>
      <div class="message-container">
        <span>忘记密码</span>
      </div>
    </div>
    <div class="right-container">
      <div class="regist-container">
        <span class="regist">注册</span>
      </div>
      <div class="actoin-container">
        <span>提交</span>
      </div>
    </div>
  </div>
</body>
</html>

CSS

代码语言:javascript复制
* {
  padding: 0;
  margin: 0;
}
html {
  height: 100%;
}
/* rgb(114,135,254)   rgb(130,88,186)
rgb(59,45,159)
rgb(95, 76, 194)
rgb(118,76,163)  rgb(92,103,211)
rgb(199, 191, 219)
rgb(237,221,22) */
body {
  background-image: linear-gradient(to bottom right,rgb(114,135,254),rgb(130,88,186));
}
body .login-container {
  width: 600px;
  height: 315px;
  margin: 0 auto;
  margin-top: 20%;
  border-radius: 15px;
  box-shadow: 0 10px 50px 0px rgb(59,45,159);
  background-color: rgb(95, 76, 194);
}
body .login-container .left-container {
  display: inline-block;
  width: 330px;
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
  padding: 60px;
  background-image: linear-gradient(to bottom right,rgb(118,76,163), rgb(92,103,211));
}
body .login-container .left-container .title {
  color: #fff;
  font-size: 18px;
  font-weight: 200;
}
body .login-container .left-container .title span {
  border-bottom: 3px solid rgb(237,221,22) ;
}
body .login-container .left-container .input-container {
  padding: 20px 0;
}
body .login-container .left-container .input-container input {
  border: 0;
  background: none;
  outline: 0;
  color: #fff;
  margin: 20px 0;
  display: block;
  width: 100%;
  padding: 5px 0;
  transition: .2s;
  border-bottom: 1px solid rgb(199, 191, 219);
}
body .login-container .left-container .input-container input:hover {
  border-bottom-color: #fff;
}
::-webkit-input-placeholder {
  color: rgb(199, 191, 219);
}
body .login-container .left-container .message-container {
  font-size: 14px;
  transition: .2s;
  color: rgb(199, 191, 219);
  cursor: pointer;
}
body .login-container .left-container .message-container:hover {
  color: #fff;
}
body .login-container .right-container {
  width: 145px;
  display: inline-block;
  height: calc(100% - 120px);
  vertical-align: top;
  padding: 60px 0;
}
body .login-container .right-container .regist-container {
  text-align: center;
  color: #fff;
  font-size: 18px;
  font-weight: 200;
}
body .login-container .right-container .regist-container span {
  border-bottom: 3px solid rgb(237,221,22) ;
}
body .login-container .right-container .actoin-container {
  font-size: 10px;
  color: #fff;
  height: 100%;
  position: relative;
}
body .login-container .right-container .actoin-container span {
  border: 1px solid rgb(237,221,22);
  padding: 10px;
  display: inline;
  line-height: 25px;
  border-radius: 25px;
  position: absolute;
  bottom: 10px;
  left: calc(72px - 25px);
  transition: .2s;
  cursor: pointer;
}
body .login-container .right-container .actoin-container span:hover {
  background-color: rgb(237,221,22);
  color: rgb(95, 76, 194);
}

温馨提示:本文最后更新于2021-11-18,若文件或内容有错误或已失效,请在下方留言。

0 人点赞