简洁的Bootstrap登录框设计效果

简洁的Bootstrap登录框设计效果

在页面中引入bootstrap文件。

1
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />

HTML结构

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<div class="form-bg">
    <div class="container">
        <div class="row">
            <div class="col-md-offset-4 col-md-4 col-sm-offset-3 col-sm-6">
                <form class="form-horizontal">
                    <div class="heading">Login Form</div>
                    <div class="form-group">
                        <i class="fa fa-user"></i><input required="" name="login[username]" type="email" class="form-control" placeholder="Username" id="exampleInputEmail1">
                    </div>
                    <div class="form-group">
                        <i class="fa fa-lock"></i><input required="" name="login[password]" type="password" class="form-control" placeholder="Password">
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-default"><i class="fa fa-arrow-right"></i></button>
                        <span>Don't have an account? <a href="" class="create_account">Sign up</a></span>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

CSS样式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.form-horizontal{
    background-color: #fff;
   font-family: 'Arimo', sans-serif;
    text-align: center;
    padding: 50px 30px 50px;
    box-shadow: 12px 12px 0 0 rgba(0,0,0,0.3);
}
 
.form-horizontal .heading{
    color: #555;
   font-size: 30px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: capitalize;
    margin: 0 0 50px 0;
}
 
.form-horizontal .form-group{
    margin: 0 auto 30px;
    position: relative;
}
 
.form-horizontal .form-group:nth-last-child(2){ margin-bottom: 20px; }
 
.form-horizontal .form-group:last-child{ margin: 0; }
 
.form-horizontal .form-group>i{
    color: #999;
   transform: translateY(-50%);
    position: absolute;
    left: 5px;
    top: 50%;
}
 
.form-horizontal .form-control{
    color: #7AB6B6;
   background-color: #fff;
   font-size: 17px;
    letter-spacing: 1px;
    height: 40px;
    padding: 5px 10px 2px 25px;
    box-shadow: 0 0 0 0 transparent;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    border-radius: 0;
    display: inline-block;
}
 
.form-control::placeholder{
    color: rgba(0,0,0,0.2);
    font-size: 16px;
}
 
.form-horizontal .form-control:focus{
    border-bottom: 1px solid #7AB6B6;
   box-shadow: none;
}
 
.form-horizontal .btn{
    color: #7AB6B6;
   background-color: #EDF6F5;
   font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 5px;
    width: 50%;
    height: 45px;
    padding: 7px 30px;
    margin: 0 auto 25px;
    border: none;
    display: block;
    position: relative;
    transition: all 0.3s ease;
}
 
.form-horizontal .btn:focus,
.form-horizontal .btn:hover{
    color: #fff;
   background-color: #7AB6B6;
}
 
.form-horizontal .btn:before,
.form-horizontal .btn:after{
    content: '';
    background-color: #7AB6B6;
   height: 50%;
    width: 2px;
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 1;
    transition: all 0.3s;
}
 
.form-horizontal .btn:after{
    bottom: auto;
    top: 0;
    left: auto;
    right: 0;
}
 
.form-horizontal .btn:hover:before,
.form-horizontal .btn:hover:after{
    height: 100%;
    width: 50%;
    opacity: 0;
}
 
.form-horizontal .create_account{
    color: #D6BC8B;
   font-size: 16px;
    font-weight: 600;
    display: inline-block;
}
 
.form-horizontal .create_account:hover{
    color: #7AB6B6;
   text-decoration: none;
}
当前内容只有登录了才能查看,如果您已经注册,请登录
1

发表评论