经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » HTML/CSS » CSS3 » 查看文章
html+css3实现的登录界面_css3_CSS
来源:jb51  时间:2020/12/14 17:00:38  对本文有异议

实现效果

先用html搭建个基本框架

  1. <body>
  2. <div class="container">
  3. <section id="content">
  4. <form action="">
  5. <h1>Login Form</h1>
  6. <div>
  7. <input type="text" placeholder="Username" required="" id="username" />
  8. </div>
  9. <div>
  10. <input type="password" placeholder="Password" required="" id="password" />
  11. </div>
  12. <div>
  13. <input type="submit" value="Log in" />
  14. <a href="#">Lost your password?</a>
  15. <a href="#">Register</a>
  16. </div>
  17. </form><!-- form -->
  18. <div class="button">
  19. <a href="#">Download source file</a>
  20. </div><!-- button -->
  21. </section><!-- content -->
  22. </div><!-- container -->
  23. </body>

接着用CSS3美化一下

  1. body {
  2. background: #DCDDDF url(https://cssdeck.com/uploads/media/items/7/7AF2Qzt.png);
  3. color: #000;
  4. font: 14px Arial;
  5. margin: 0 auto;
  6. padding: 0;
  7. position: relative;
  8. }
  9. h1{ font-size:28px;}
  10. h2{ font-size:26px;}
  11. h3{ font-size:18px;}
  12. h4{ font-size:16px;}
  13. h5{ font-size:14px;}
  14. h6{ font-size:12px;}
  15. h1,h2,h3,h4,h5,h6{ color:#563D64;}
  16. small{ font-size:10px;}
  17. b, strong{ font-weight:bold;}
  18. a{ text-decoration: none; }
  19. a:hover{ text-decoration: underline; }
  20. .left { float:left; }
  21. .right { float:right; }
  22. .alignleft { float: left; margin-right: 15px; }
  23. .alignright { float: right; margin-left: 15px; }
  24. .clearfix:after,
  25. form:after {
  26. content: ".";
  27. display: block;
  28. height: 0;
  29. clear: both;
  30. visibility: hidden;
  31. }
  32. .container { margin: 25px auto; position: relative; width: 900px; }
  33. #content {
  34. background: #f9f9f9;
  35. background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%);
  36. background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  37. background: -o-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  38. background: -ms-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  39. background: linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  40. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#f9f9f9',GradientType=0 );
  41. -webkit-box-shadow: 0 1px 0 #fff inset;
  42. -moz-box-shadow: 0 1px 0 #fff inset;
  43. -ms-box-shadow: 0 1px 0 #fff inset;
  44. -o-box-shadow: 0 1px 0 #fff inset;
  45. box-shadow: 0 1px 0 #fff inset;
  46. border: 1px solid #c4c6ca;
  47. margin: 0 auto;
  48. padding: 25px 0 0;
  49. position: relative;
  50. text-align: center;
  51. text-shadow: 0 1px 0 #fff;
  52. width: 400px;
  53. }
  54. #content h1 {
  55. color: #7E7E7E;
  56. font: bold 25px Helvetica, Arial, sans-serif;
  57. letter-spacing: -0.05em;
  58. line-height: 20px;
  59. margin: 10px 0 30px;
  60. }
  61. #content h1:before,
  62. #content h1:after {
  63. content: "";
  64. height: 1px;
  65. position: absolute;
  66. top: 10px;
  67. width: 27%;
  68. }
  69. #content h1:after {
  70. background: rgb(126,126,126);
  71. background: -moz-linear-gradient(left, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%);
  72. background: -webkit-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  73. background: -o-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  74. background: -ms-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  75. background: linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  76. right: 0;
  77. }
  78. #content h1:before {
  79. background: rgb(126,126,126);
  80. background: -moz-linear-gradient(right, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%);
  81. background: -webkit-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  82. background: -o-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  83. background: -ms-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  84. background: linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
  85. left: 0;
  86. }
  87. #content:after,
  88. #content:before {
  89. background: #f9f9f9;
  90. background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%);
  91. background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  92. background: -o-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  93. background: -ms-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  94. background: linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
  95. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#f9f9f9',GradientType=0 );
  96. border: 1px solid #c4c6ca;
  97. content: "";
  98. display: block;
  99. height: 100%;
  100. left: -1px;
  101. position: absolute;
  102. width: 100%;
  103. }
  104. #content:after {
  105. -webkit-transform: rotate(2deg);
  106. -moz-transform: rotate(2deg);
  107. -ms-transform: rotate(2deg);
  108. -o-transform: rotate(2deg);
  109. transform: rotate(2deg);
  110. top: 0;
  111. z-index: -1;
  112. }
  113. #content:before {
  114. -webkit-transform: rotate(-3deg);
  115. -moz-transform: rotate(-3deg);
  116. -ms-transform: rotate(-3deg);
  117. -o-transform: rotate(-3deg);
  118. transform: rotate(-3deg);
  119. top: 0;
  120. z-index: -2;
  121. }
  122. #content form { margin: 0 20px; position: relative }
  123. #content form input[type="text"],
  124. #content form input[type="password"] {
  125. -webkit-border-radius: 3px;
  126. -moz-border-radius: 3px;
  127. -ms-border-radius: 3px;
  128. -o-border-radius: 3px;
  129. border-radius: 3px;
  130. -webkit-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
  131. -moz-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
  132. -ms-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
  133. -o-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
  134. box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
  135. -webkit-transition: all 0.5s ease;
  136. -moz-transition: all 0.5s ease;
  137. -ms-transition: all 0.5s ease;
  138. -o-transition: all 0.5s ease;
  139. transition: all 0.5s ease;
  140. background: #eae7e7 url(https://cssdeck.com/uploads/media/items/8/8bcLQqF.png) no-repeat;
  141. border: 1px solid #c8c8c8;
  142. color: #777;
  143. font: 13px Helvetica, Arial, sans-serif;
  144. margin: 0 0 10px;
  145. padding: 15px 10px 15px 40px;
  146. width: 80%;
  147. }
  148. #content form input[type="text"]:focus,
  149. #content form input[type="password"]:focus {
  150. -webkit-box-shadow: 0 0 2px #ed1c24 inset;
  151. -moz-box-shadow: 0 0 2px #ed1c24 inset;
  152. -ms-box-shadow: 0 0 2px #ed1c24 inset;
  153. -o-box-shadow: 0 0 2px #ed1c24 inset;
  154. box-shadow: 0 0 2px #ed1c24 inset;
  155. background-color: #fff;
  156. border: 1px solid #ed1c24;
  157. outline: none;
  158. }
  159. #username { background-position: 10px 10px !important }
  160. #password { background-position: 10px -53px !important }
  161. #content form input[type="submit"] {
  162. background: rgb(254,231,154);
  163. background: -moz-linear-gradient(top, rgba(254,231,154,1) 0%, rgba(254,193,81,1) 100%);
  164. background: -webkit-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
  165. background: -o-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
  166. background: -ms-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
  167. background: linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
  168. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fee79a', endColorstr='#fec151',GradientType=0 );
  169. -webkit-border-radius: 30px;
  170. -moz-border-radius: 30px;
  171. -ms-border-radius: 30px;
  172. -o-border-radius: 30px;
  173. border-radius: 30px;
  174. -webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
  175. -moz-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
  176. -ms-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
  177. -o-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
  178. box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
  179. border: 1px solid #D69E31;
  180. color: #85592e;
  181. cursor: pointer;
  182. float: left;
  183. font: bold 15px Helvetica, Arial, sans-serif;
  184. height: 35px;
  185. margin: 20px 0 35px 15px;
  186. position: relative;
  187. text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  188. width: 120px;
  189. }
  190. #content form input[type="submit"]:hover {
  191. background: rgb(254,193,81);
  192. background: -moz-linear-gradient(top, rgba(254,193,81,1) 0%, rgba(254,231,154,1) 100%);
  193. background: -webkit-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
  194. background: -o-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
  195. background: -ms-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
  196. background: linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
  197. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fec151', endColorstr='#fee79a',GradientType=0 );
  198. }
  199. #content form div a {
  200. color: #004a80;
  201. float: right;
  202. font-size: 12px;
  203. margin: 30px 15px 0 0;
  204. text-decoration: underline;
  205. }
  206. .button {
  207. background: rgb(247,249,250);
  208. background: -moz-linear-gradient(top, rgba(247,249,250,1) 0%, rgba(240,240,240,1) 100%);
  209. background: -webkit-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
  210. background: -o-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
  211. background: -ms-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
  212. background: linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
  213. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f9fa', endColorstr='#f0f0f0',GradientType=0 );
  214. -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
  215. -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
  216. -ms-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
  217. -o-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
  218. box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
  219. -webkit-border-radius: 0 0 5px 5px;
  220. -moz-border-radius: 0 0 5px 5px;
  221. -o-border-radius: 0 0 5px 5px;
  222. -ms-border-radius: 0 0 5px 5px;
  223. border-radius: 0 0 5px 5px;
  224. border-top: 1px solid #CFD5D9;
  225. padding: 15px 0;
  226. }
  227. .button a {
  228. background: url(https://cssdeck.com/uploads/media/items/8/8bcLQqF.png) 0 -112px no-repeat;
  229. color: #7E7E7E;
  230. font-size: 17px;
  231. padding: 2px 0 2px 40px;
  232. text-decoration: none;
  233. -webkit-transition: all 0.3s ease;
  234. -moz-transition: all 0.3s ease;
  235. -ms-transition: all 0.3s ease;
  236. -o-transition: all 0.3s ease;
  237. transition: all 0.3s ease;
  238. }
  239. .button a:hover {
  240. background-position: 0 -135px;
  241. color: #00aeef;
  242. }

以上就是html+css3实现的登录界面的详细内容,更多关于html+css3 登录界面的资料请关注w3xue其它相关文章!

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号