PHP開發(fā)注冊頁面之css樣式
我們先看一下上一節(jié)我們的注冊頁面代碼
<!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>用戶注冊</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>驗 證 碼:<input type="text" name="yzm" id="yzm"></p> <p><button type="submit" value="注冊" >立即注冊</button></p> </div> </div> </form> </body> </html>
上面的代碼我們可以看到,我們使用兩個div進(jìn)行布局的,所以我們先對兩個div進(jìn)行樣式設(shè)計,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;
}
然后下面在對我們的input標(biāo)簽進(jìn)行樣式設(shè)計,css代碼如下
input{
width: 180px;
height: 25px;
}
width: 180px;
height: 25px;
}
頁面中還有一個butto按鈕,我們?yōu)榱税粹o看起來美觀,對按鈕也做了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;
}
最好再把我們的注冊頁面加入背景色
body{background-color: rgba(223, 255, 231, 0.28)
}
}
把上面的css樣式加入到頁面中,這樣我們的頁面看起來內(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>用戶注冊</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>驗 證 碼:<input type="text" name="yzm" id="yzm"> </p> <p><button type="submit" value="注冊" >立即注冊</button></p> </div> </div> </form> </body> </html>
這樣我們的頁面就好看多了,下一步就是需要把我們的驗證碼加入到頁面中