当前位置: 移动技术网 > IT编程>网页制作>Html5 > 运用HTML5+CSS3和CSS滤镜做的精美的登录界面,无用到图片的

运用HTML5+CSS3和CSS滤镜做的精美的登录界面,无用到图片的

2018年09月14日  | 移动技术网IT编程  | 我要评论

不少人为项目没有一个简洁和精美的登录页而烦恼,今天上班没多少事情做,在51cto里看了篇关于“使用html 5和css3制作登录页面完整步骤”的文章,我就动手做了一下,现在将代码贴出来,因为个人认为ie6在不久的将来必定被舍弃,所以这个登录页面的代码没有理会ie6里的情况。
代码如下:
1.      <!doctype html>
2.      <html>
3.      <head>
4.      <meta http-equiv="content-type" content="text/html; charset=gb2312">
5.      <meta http-equiv="description" content="运用css3和css滤镜做的精美的登录界面,无用到图片的喔!">
6.      <meta http-equiv="author" content="chenjinfei">
7.      <meta http-equiv="date" content="2012-2-6">
8.      <title>登录</title>
9.      <link rel="stylesheet" href="style/common/common.css">
10.   <style type="text/css">
11.   body {
12.       margin:0;
13.       padding:0;
14.       background-color:#e4e8ec;
15.   }
16.   .wrap {
17.       margin:150px auto;
18.       width:380px;
19.       overflow:hidden;
20.   }
21.   .loginform {
22.       box-shadow: 0 0 2px rgba(0, 0, 0, 0.2), 0 1px 1px rgba(0, 0, 0, 0.2), 0 3px 0 #fff, 0 4px 0 rgba(0, 0, 0, 0.2), 0 6px 0 #fff, 0 7px 0 rgba(0, 0, 0, 0.2);
23.       position:absolute;
24.       z-index:0;
25.       background-color:#fff;
26.       border-radius:4px;
27.       height:250px;
28.       width:380px;
29.       background: -webkit-gradient(linear, left top, left 24, from(#eee), color-stop(4%, #fff), to(#eee));
30.       background: -moz-linear-gradient(top, #eee, #fff 1px, #eee 24px);
31.       background: -o-linear-gradient(top, #eeeeee, #ffffff 1px, #eeeeee 24px);
32.   }
33.   .loginform:before {
34.       content:'';
35.       position:absolute;
36.       z-index:-1;
37.       border:1px dashed #ccc;
38.      top:5px;
39.       bottom:5px;
40.       left:5px;
41.       right:5px;
42.       box-shadow: 0 0 0 1px #fff;
43.   }
44.   .loginform h1 {
45.       text-shadow: 0 1px 0 rgba(255, 255, 255, .7), 0px 2px 0 rgba(0, 0, 0, .5);
46.       text-transform:uppercase;
47.       text-align:center;
48.       color:#666;
49.       line-height:3em;
50.       margin:16px 0 20px 0;
51.       letter-spacing: 4px;
52.       font:normal 26px/1 microsoft yahei, sans-serif;
53.   }
54.   fieldset {
55.       border:none;
56.       padding:10px 10px 0;
57.   }
58.   fieldset input[type=text] {
59.       background:url(style/default/images/user.png) 4px 5px no-repeat;
60.   }
61.   fieldset input[type=password] {
62.       background:url(style/default/images/password.png) 4px 5px no-repeat;
63.   }
64.   fieldset input[type=text], fieldset input[type=password] {
65.       width:100%;
66.       line-height:2em;
67.       font-size:12px;
68.       height:24px;
69.       border:none;
70.       padding:3px 4px 3px 2.2em;
71.       width:300px;
72.   }
73.   fieldset input[type=submit] {
74.       text-align:center;
75.       padding:2px 20px;
76.       line-height:2em;
77.       border:1px solid #ff1500;
78.       border-radius:3px;
79.       background: -webkit-gradient(linear, left top, left 24, from(#ff6900), color-stop(0%, #ff9800), to(#ff6900));
80.       background: -moz-linear-gradient(top, #ff6900, #ff9800 0, #ff6900 24px);
81.       background:-o-linear-gradient(top, #ff6900, #ff9800 0, #ff6900 24px);
82.   filter: progid:dximagetransform.microsoft.gradient(startcolorstr='#ff9800', endcolorstr='#ff6900');
83.       -ms-filter: "progid:dximagetransform.microsoft.gradient(startcolorstr='#ff9800', endcolorstr='#ff6900')";
84.       height:30px;
85.       cursor:pointer;
86.       letter-spacing: 4px;
87.       margin-left:10px;
88.       color:#fff;
89.       font-weight:bold;
90.   }
91.   fieldset input[type=submit]:hover {
92.       background: -webkit-gradient(linear, left top, left 24, from(#ff9800), color-stop(0%, #ff6900), to(#ff9800));
93.       background: -moz-linear-gradient(top, #ff9800, #ff6900 0, #ff9800 24px);
94.       background:-o-linear-gradient(top, #ff6900, #ff6900 0, #ff9800 24px);
95.   filter: progid:dximagetransform.microsoft.gradient(startcolorstr='#ff6900', endcolorstr='#ff9800');
96.       -ms-filter: "progid:dximagetransform.microsoft.gradient(startcolorstr='#ff6900', endcolorstr='#ff9800')";
97.   }
98.   .inputwrap {
99.       background: -webkit-gradient(linear, left top, left 24, from(#ffffff), color-stop(4%, #eeeeee), to(#ffffff));
100.    background: -moz-linear-gradient(top, #ffffff, #eeeeee 1px, #ffffff 24px);
101.    background: -o-linear-gradient(top, #ffffff, #eeeeee 1px, #ffffff 24px);
102.    border-radius:3px;
103.    border:1px solid #ccc;
104.    margin:10px 10px 0;
105.filter: progid:dximagetransform.microsoft.gradient(startcolorstr='#eeeeee', endcolorstr='#ffffff');
106.    -ms-filter: "progid:dximagetransform.microsoft.gradient(startcolorstr='#eeeeee', endcolorstr='#ffffff')";
107.}
108.fieldset input[type=checkbox] {
109.    margin-left:10px;
110.    vertical-align:middle;
111.}
112.fieldset a {
113.    color:blue;
114.    font-size:12px;
115.    margin:6px 0 0 10px;
116.    text-decoration:none;
117.}
118.fieldset a:hover {
119.    text-decoration:underline;
120.}
121.fieldset span {
122.    font-size:12px;
123.}
124.</style>
125.<!--为了让ie支持html5元素,做如下操作:-->
126.<!--[if ie]>
127.<script type="text/javascript">
128.document.createelement("section");
129.document.createelement("header");
130.document.createelement("footer");
131.</script>
132.<![endif]-->
133.</head>
134.
135.<body>
136.<p class="wrap">
137.  <form action="#" method="post">
138.    <section class="loginform">
139.      <header>
140.        <h1>登录</h1>
141.      </header>
142.      <p class="loginform_content">
143.        <fieldset>
144.          <p class="inputwrap">
145.            <input type="text" name="username" placeholder="邮箱/会员帐号/手机号" autofocus required>
146.          </p>
147.          <p class="inputwrap">
148.            <input type="password" name="password" placeholder="请输入密码" required>
149.          </p>
150.        </fieldset>
151.        <fieldset>
152.          <input type="checkbox" checked="checked">
153.          <span>下次自动登录</span>
154.        </fieldset>
155.        <fieldset>
156.          <input type="submit" value="登录">
157.          <a href="#">忘记密码?</a> <a href="#">注册</a>
158.        </fieldset>
159.      </p>
160.    </section>
161.  </form>
162.</p>
163.</body>
164.</html>
当然啦,有图会直观不少:


 
本文出自 “html5+css3” 博客
  

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网