如何制作一个简单动态背景登录页面?

1 篇文章 0 订阅
1 篇文章 0 订阅

所需文件如下:

 草方块.ico为页签图标(可以替换为自己想要得图标icon)

new_video.mp4为背景视频(可以替换为自己的视频内容)

 

 login.html文件内容

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- charset设置页面的编码为UTF-8-->
    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- title标签设置页面的标签页的名字-->
    <title>mc-sharing-proj</title>
    <!-- link设置页面的图标,rel属性是必须的,规定当前文档与被链接文档/资源之间的关系。href为图标文件的路径-->
    <link rel="shortcut icon" href="../images/草方块.ico">
    <link type="text/css" href="../style/login.css" rel="stylesheet">
</head>
<body>

<div class="login-page" id="login-app">
    <video id="background_v" autoplay loop muted>
        <source id='background' src="../video/new_video.mp4"/>
    </video>
    <div class="login-box">
        <h1>Login</h1>
        <form action="">
            <div class="inputBox">
                <input type = 'text' name="" required="">
                <label>Username</label>
            </div>
            <div class="inputBox">
                <input type = 'password' name="" required="">
                <label>Password</label>
            </div>
            <input type="submit" name="" value="Submit">

        </form>
    </div>
</div>
</body>
</html>

 login.css文件内容

@charset "utf-8";
/*CSS Document */
body {
    margin: 0px;
    padding: 0px;
    font-family: sans-serif;
}

.login-box {
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    padding: 30px;
    background: rgba(255, 255, 255, .5);
    box-sizing: border-box;
    box-shadow: 0 15px 25px rgba(255, 255, 255, .3);
    border-radius: 10px;
}

.login-box h1 {
    margin: 0 0 30px;
    padding: 0px;
    color: rgba(255, 255, 255, .9);
    text-align: center;

}

.login-box .inputBox {
    position: relative;
}

.login-box .inputBox input {
    width: 100%;
    padding: 10px 0;
    font-size: 22px;
    color: rgba(0, 0, 0, .7);
    margin-bottom: 30px;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, .8);
    outline: none;
    background: transparent;
}

.login-box .inputBox label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px 0;
    font-size: 22px;
    color: rgba(0, 0, 0, .3);
    pointer-events: none;
    transition: .5s;
}

.login-box .inputBox input:focus ~ label,
.login-box .inputBox input:valid ~ label {
    top: -20px;
    left: 0;
    color: rgba(0, 0, 0, .7);
    font-size: 16px;
}

.login-box input[type="submit"] {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    border: none;
    outline: none;
    background: rgba(255,255,255,.7);
    font-size: 20px;
    color: rgba(0,0,0,.7);
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

#background_v {
    position: fixed;
    right: 0px;
    bottom: 0px;
    min-width: 100%;
    min-height: 100%;
    height: auto;
    width: auto;
    /*加滤镜*/
    /*filter: blur(15px); //背景模糊设置 */
    /*-webkit-filter: grayscale(100%);*/
    /*filter:grayscale(100%); //背景灰度设置*/
    z-index: -11
}

#background {
    min-width: 100%;
    min-height: 100%;
    height: auto;
    width: auto;
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值