HTML+CSS实现简单登录界面

HTML内容:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录界面</title>
    <link rel="stylesheet" href="index.css">
</head>
<body>
   <div class="container">
    <!-- 图片 -->
    <img src="cloud.jpeg" alt="..." class="left">
    <!-- 登录 -->
    <div class="right">
        <span class="logo"><h2>欢迎登录</h2></span>
        <form class="contents">
            <input type="text" placeholder="请输入账号" name="uname" required>
            <input type="password" placeholder="请输入密码" name="paw" required>
            <div class="verify">
                <input type="text" placeholder="验证码" id="verifys" required>
                <button class="emit_verify">发送验证码</button>
            </div>
            <button class="login" type="submit">马上登录</button>
            <span class="footer">
                <a>注册</a>
                <a>忘记密码?</a>
            </span>
        </form>
    </div>
</div>
</body>
</html>

CSS样式内容:

*{
    margin: 0;
    padding: 0;
}
body{
    background-image: url('bg.jpg');
    background-repeat: no-repeat;
    /* 宽度 高度 */
    background-size: cover;
}
    /* 容器 */
.container{
    width: 50%;
    height: 320px;
    position: fixed;
    top: 50%;
    left: 50%;
    border-radius: 15px;
    box-shadow: 0 0 15px rgb(12, 67, 101);
    transform: translate(-50%,-50%);
}
/* 左边图片 */
.container img{
    width: auto;
    height: auto;
    max-width: 50%;
    min-height: 100%;
    border-top-left-radius:10px ;
    border-bottom-left-radius: 10px;
    -webkit-user-drag: none;
    object-fit: cover;
}
.left{
    opacity: 0.8;
    animation-name: mountain;
    animation-duration: 12s;
}
@keyframes mountain{
    0%   {opacity: 0;}
    25%  {opacity: 0.4;}
    50%  {opacity: 0.8;}
    100% {opacity: 1;}
}
/* 右边内容 */
.right{
    display: block;
    width: 50%;
    height: 100%;
    float: right;
    text-align: center;
    background-color: rgb(223, 223, 223);
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}
/* logo */
.right span.logo{
    margin-top: 22px;
    margin-bottom: 10px;
    display: block;
}
/* 登陆界面 */
.contents{
    height: 80%;
}
/* 密码框和账号框 */
.contents input{
    width: 75%;
    height: 20px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
}
.verify{
    position: relative;
    width: 100%;
}
.verify input{
    width: 75%;
}
.verify button.emit_verify{
    height: 30px;
    position: absolute;
    right: 10%;
    outline: none;
    margin-top: 14px;
    padding: 5px;
    border: none;
    background-color: white;
    color: blue;
    border-radius: 8px;
}
.contents button.login{
    border: none;
    outline: none;
    margin-top: 20px;
    width: 82%;
    height: 18%;
    padding: 5px;
    border-radius: 10px;
    font-size: 16px;
    color: white;
    background-image: linear-gradient(to right,lightblue,blue);
}
/* 登录下的文本 */
.contents span.footer{
    display: block;
    margin-top: 10px;
}

span a{
    font-size: 10px;
    color: grey;
}
span a:first-child{
    margin-left: 10%;
    float: left;
}
span a:last-child{
    margin-right: 10%;
    float: right;
}

/* 文本框内的内容 */
input::placeholder{
    font-size: 14px;
}
/* 伪类 */
span a:hover{
    color: blue;
}
span a:active{
    color: skyblue;
}
span a:link{
    color: dodgerblue;
}
span a:visited{
    color: deepskyblue;
}
.verify button:hover{
    color: dodgerblue;
}
.verify button:active{
    color: skyblue;
}
.verify button:link{
    color: deepskyblue;
}
.verify button:visited{
    color: red;
}
div button.login:hover{
    background-image: linear-gradient(to right,rgb(0, 0, 110),rgb(0,0,110));
}

图片资源:

效果图:

 

 

  • 3
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值