效果如下:
代碼如下:
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>登錄</title> 6 <style type="text/css"> 7 * {margin:0;padding:0;}/*去掉頁面樣式*/ 8 body{ 9 color:white; 10 } 11 .content{ 12 background-color:yellow; 13 left:0; 14 width:100%; 15 height:400px; 16 margin-top:0px; 17 overflow:hidden;/*隱藏滾動條*/ 18 } 19 .main{ 20 text-align:center;/*文本居中*/ 21 max-width:600px; 22 height:400px; 23 padding:100px 0px;/*上下80px,左右為0*/ 24 /*background:yellow;*//*驗證div的位置*/ 25 margin:0 auto;/*設置上右下左,居中顯示*/ 26 } 27 .main h1{ 28 font-family:"楷體";/*設置字體*/ 29 font-size:70px;/*設置字體大小*/ 30 font-weight:2px;/*調整字體粗細*/ 31 border-radius:30px; 32 border:1px solid pink; 33 color: blue; 34 background-color:pink; 35 } 36 form{ 37 padding:20px 0; 38 } 39 form input{ 40 border:1px solid white; 41 display:block; 42 margin:0px auto 10px auto;/*上 右 下 左*/ 43 padding:10px; 44 width:220px; 45 border-radius:30px;/*H5設置圓角邊框*/ 46 border-style: solid; 47 font-size:18px; 48 font-weight:300; 49 text-align:center; 50 border-top-color: #000000; 51 border-left-color: #000000; 52 } 53 form input:hover{ 54 background-color:yellow; 55 } 56 form button{ 57 background-color:whitesmoke; 58 border-radius:10px; 59 border:0; 60 height:30px; 61 width:50px; 62 padding:5px 10px; 63 } 64 form button:hover{ 65 background-color:red; 66 } 67 </style> 68 </head> 69 <div class="content"> 70 <div class="main"> 71 <h1>登錄</h1> 72 <form> 73 <input type="text" name="useid" placeholder="請輸入賬號"/> 74 <input type="password" name="pw" placeholder="請輸入密碼"> 75 <button type="submit">登 錄</button> 76 <button type="submit">注 冊</button> 77 </form> 78 </div> 79 </div> 80 <body> 81 </body> 82 </html>