PHP開發註冊頁面之css樣式

我們先看一下上一節我們的註冊頁面代碼

<!doctype html>
<html>
<head>
 <meta charset="utf-8">
 <title>PHP中文网</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>确认密码: <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進行佈局的,所以我們先對兩個div進行樣式設計, css程式碼如下

.container{
    border-radius: 25px;
    box-shadow: 0 0 20px # ;
    margin: 0 auto;
    margin-top: 200px;
    background-color: r : relative;
    left: 40px;
    top: 20px;
}


然後下面在對我們的input標籤進行樣式設計,css代碼如下

input{
    width: 180px;

    height: 25px;

}

#頁中還有一個butto按鈕,我們為了按鈕看起來美觀,對按鈕也做了css樣式,程式碼如下

button{
    background-color: rgba(230, 228, 236, 0.93);

   110c0f;

    padding: 10px 70px;
    text-align: center;
    display: inline-block;##point     margin-top : 30px;
    margin-left: 50px;
}


最好再把我們的註冊頁面加入背景色


body{background-color : rgba(223, 255, 231, 0.28)
}


把上面的css樣式加入頁面中,這樣我們的頁面看起來內容就能豐富很多


#完整程式碼如下##

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>PHP中文网</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>确认密码: <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>

這樣我們的頁面就好看多了,下一步就是需要把我們的驗證碼加入頁面中

繼續學習
||
<!doctype html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</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>确认密码: <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>
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!