PHP開發(fā)注冊(cè)頁(yè)面之css樣式
我們先看一下上一節(jié)我們的注冊(cè)頁(yè)面代碼
<!doctype html> <html> <head> <meta charset="utf-8"> <title>PHP中文網(wǎng)</title> </head> <body> <form action="" method="post"> <div class="container"> <div class="right"> <h2>用戶注冊(cè)</h2> <p>用 戶 名:<input type="text" name="name" id="name"></p> <p>密 碼: <input type="password" name="pwd" id="pwd"></p> <p>確認(rèn)密碼: <input type="password" name="pwdconfirm" id="pwdconfirm"></p> <p>驗(yàn) 證 碼:<input type="text" name="yzm" id="yzm"></p> <p><button type="submit" value="注冊(cè)" >立即注冊(cè)</button></p> </div> </div> </form> </body> </html>
上面的代碼我們可以看到,我們使用兩個(gè)div進(jìn)行布局的,所以我們先對(duì)兩個(gè)div進(jìn)行樣式設(shè)計(jì),css代碼如下
.container{
????border-radius:?25px;
????box-shadow:?0?0?20px?#222;
????width:?380px;
????height:?400px;
????margin:?0?auto;
????margin-top:?200px;
????background-color:?rgba(152,?242,?242,?0.23);
}
.right?{
????position:?relative;
????left:?40px;
????top:?20px;
}
????border-radius:?25px;
????box-shadow:?0?0?20px?#222;
????width:?380px;
????height:?400px;
????margin:?0?auto;
????margin-top:?200px;
????background-color:?rgba(152,?242,?242,?0.23);
}
.right?{
????position:?relative;
????left:?40px;
????top:?20px;
}
然后下面在對(duì)我們的input標(biāo)簽進(jìn)行樣式設(shè)計(jì),css代碼如下
input{
????width:?180px;
????height:?25px;
}
????width:?180px;
????height:?25px;
}
頁(yè)面中還有一個(gè)butto按鈕,我們?yōu)榱税粹o看起來美觀,對(duì)按鈕也做了css樣式,代碼如下
button{
????background-color:?rgba(230,?228,?236,?0.93);
????border:?none;
????color:?#110c0f;
????padding:?10px?70px;
????text-align:?center;
????display:?inline-block;
????font-size:?16px;
????cursor:?pointer;
????margin-top:?30px;
????margin-left:?50px;
}
????background-color:?rgba(230,?228,?236,?0.93);
????border:?none;
????color:?#110c0f;
????padding:?10px?70px;
????text-align:?center;
????display:?inline-block;
????font-size:?16px;
????cursor:?pointer;
????margin-top:?30px;
????margin-left:?50px;
}
最好再把我們的注冊(cè)頁(yè)面加入背景色
body{background-color:?rgba(223,?255,?231,?0.28)
}
}
把上面的css樣式加入到頁(yè)面中,這樣我們的頁(yè)面看起來內(nèi)容就能豐富很多
完整代碼如下
<!doctype html> <html> <head> <meta charset="utf-8"> <title>PHP中文網(wǎng)</title> <style type="text/css"> body{background-color: rgba(223, 255, 231, 0.28) } .container{ border-radius: 25px; box-shadow: 0 0 20px #222; width: 380px; height: 400px; margin: 0 auto; margin-top: 200px; background-color: rgba(152, 242, 242, 0.23); } .right { position: relative; left: 40px; top: 20px; } input{ width: 180px; height: 25px; } button{ background-color: rgba(230, 228, 236, 0.93); border: none; color: #110c0f; padding: 10px 70px; text-align: center; display: inline-block; font-size: 16px; cursor: pointer; margin-top: 30px; margin-left: 50px; } </style> </head> <body> <form action="" method="post"> <div class="container"> <div class="right"> <h2>用戶注冊(cè)</h2> <p>用 戶 名:<input type="text" name="name" id="name"></p> <p>密 碼: <input type="password" name="pwd" id="pwd"></p> <p>確認(rèn)密碼: <input type="password" name="pwdconfirm" id="pwdconfirm"></p> <p>驗(yàn) 證 碼:<input type="text" name="yzm" id="yzm"> </p> <p><button type="submit" value="注冊(cè)" >立即注冊(cè)</button></p> </div> </div> </form> </body> </html>
這樣我們的頁(yè)面就好看多了,下一步就是需要把我們的驗(yàn)證碼加入到頁(yè)面中