效果图

在这里插入图片描述
在这里插入图片描述在这里插入图片描述

代码

HTML

<!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">
    <title>Login</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div id="login-box">
    <form action="">
        <h1>Login</h1>
        <div class="form">
            <div class="item">
                <i class="fa fa-user-circle-o" aria-hidden="true"></i>
                <input type="text" placeholder="Username" required/>
            </div>
            <div class="item">
                <i class="fa fa-key" aria-hidden="true"></i>
                <input type="password" placeholder="Password" required/>
            </div>
        </div>
        <button type="submit">Login</button>
    </form>
</div>
</body>
</html>

CSS

body {
    /*在这里可以设置不同的网页背景图片,也可以设置为循环播放的,暂时没实现*/
    background: url('24hr-Earth_11.jpeg');
    /*background: url('earth_view_1.jpeg');*/
    /*background: url('earth_view_2.jpeg');*/
    background-repeat: no-repeat;
    background-size: 100% auto;
}

#login-box {
    width: 30%;
    height: auto;
    margin: 0 auto;
    margin-top: 15%;
    text-align: center;
    background: #00000090;
    padding: 20px 50px;
}

#login-box h1 {
    color: #fff;
}

#login-box .form .item {
    margin-top: 15px;
}

#login-box .form .item i {
    font-size: 18px;
    color: #fff;
}

#login-box .form .item input {
    width: 180px;
    font-size: 18px;
    border: 0;
    border-bottom: 2px solid #fff;
    padding: 5px 10px;
    background: #ffffff00;
    color: #fff;
}

#login-box button {
    margin-top: 15px;
    width: 180px;
    height: 30px;
    font-size: 20px;
    font-weight: 400;
    color: #fff;
    border: 0;
    border-radius: 15px;
    /*在这里可以设置不同Login提交按钮的样式*/
    /*background: #1abc9c;*/
    /*background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 100%);*/
    background-image: linear-gradient(to right, #e4afcb 0%, #b8cbb8 0%, #b8cbb8 0%, #e2c58b 30%, #c2ce9c 64%, #7edbdc 100%);
}

资源

百度云链接,提取码: kk8r
资源中的三张图片,可以做高清壁纸哦,如果此文章对你有用的话,请给个一键三连~O(∩_∩)O~

参考

HTML和CSS实现炫酷的登录页面

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐