html5+css3 登录页面

效果图

代码如下:

css文件

该文件命名为 login.css

/*

 login.html 页面中使用的css样式

*/
.container{
    position: relative;
}

#bg_div{
    margin:0px auto;
    background: url(../img/bg.jfif) no-repeat; /* 设置背景图片, 注意图片的位置,可以更改*/
    width: 1280px;
    height:730px;
    text-align: center;
}

.form_div{
    position: absolute;/* 设置绝对布局*/
    top:  100px;
    right:300px;
    width: 400px;
    height: 400px;
    background-color: #fff;
    opacity: 0.6;/* 设置透明度*/
}
.form_div h2{
    text-align: center;
    font-weight: 700;
    color: black;
    margin:30px;
}
.form_div .form-group{
    text-align: center;
}
.form_div .form-group input{
    width:300px;
    display: inline-block;
    margin:15px;
    line-height:35px;
    
}
.form_div .form-group input:focus{
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);/* 设置阴影位置*/ 
}
.form-group-left{
    text-align: left;
    margin:15px;
    width:300px;
}
.form-group-right{
    text-align: right;
    margin-right:50px;
}
.form-group-left a{
    color:#55aaff;
    font-size: 16px;
    padding-left: 32px;
    text-decoration: none;/* 设置 去掉文本装饰 (去掉超链接默认的下划线)*/
}
.form-group-right button{
    background-color: blue;
    color: #FFFFFF;
    border-radius: 10px;/* 设置 边框圆角半径 10px*/
    border: none;
    width:300px;
    height:40px;
}
 

html 源码

该文件命名为login.html

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>登录页面标题</title>
        <link href="css/login.css" rel="stylesheet">   <!-- 注意目录位置-->
    </head>
    <body>
        <div class="container">
            <!-- 背景层 -->
           <div id="bg_div"></div>
           <!-- 登录信息层-->
           <div class="form_div">
               <h2>登录</h2>
               <!-- 表单层 -->
              <form action="1.html" method="post">
                   <div class="form-group">
                       <input name="username" type="text" placeholder="请输入您的用户名" required="required" />
                   </div>
                   <div class="form-group">
                           <input name="password" type="password" placeholder="请输入您的密码" required="required"/>
                   </div>
                   <div class="form-group-left">
                           <a href="1.html">没有账号,立即注册</a>
                   </div>
                   <div class="form-group-right">
                       <button>登录</button>
                   </div>
                   
              </form>
              
           </div>
        </div>
    </body>
</html>

背景图自己随意替换即可,  只需要将css文件 放入到css目录下, 然后在html引入即可

  • 33
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

射手座的程序媛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值