html / css simple form instance

How to read as follows pictures? Let us together make this form page

FIG assignments is as follows

Here Insert Picture Description

FIG job is done as follows

Here Insert Picture Description

The example code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第一个input作业</title>
    <style>
        form{
            width: 600px;
        }
        h2{
            text-align: center;
        }
        .name{
            font-size:18px;
            display: inline-block;
            width: 100px;
            height: 40px;
        }
        .red{
            color: red;
        }
        .name1{
            width: 120px;
            height: 40px;
        }
        input{
            width: 220px;
            height: 25px;
        }
        select{
            width: 60px;
            height: 25px;
        }
        .button{
            font-size:18px;
            background-color:rgba(128,128,128,0.1);
            border-radius: 5px;
        }
        .button1{
            margin-left: 180px;
            width:110px;
        }
        .button2{
            margin-left: 15px;
            width:55px;
        } 
    </style>
</head>
<body>
    <form action="#">
        <fieldset>
            <legend>用户注册页面</legend>
            <h2>用户登录信息</h2>
            <table>
                <tr>
                    <td class='name'>用户名</td>
                    <td>
                        <input type="text" id="txtUserName" autofocus="true" pattern="^[a-zA-Z0-9]{6,}$">
                        <span class='red'>*</span><br />
                    </td>
                </tr>
                <tr>
                    <td class='name'>邮箱</td>
                    <td>
                        <input type="email" required='true'>
                        <span class='red'>*</span><br />
                    </td>
                </tr>
                <tr>
                    <td class='name'>密码</td>
                    <td>
                        <input type="password" required='true'>
                        <span class='red'>*</span><br />
                    </td>
                </tr>
                <tr>
                    <td class='name'>确认密码</td>
                    <td>
                        <input type="password" required='true'>
                        <span class='red'>*<span><br />
                    </td>
                </tr>
            </table>
            <h2>用户基本信息</h2>
            <table>
                <tr>
                    <td class='name name1'>性别</td>
                    <td>
                        <select>
                            <option value="boy"></option>
                            <option value="girl"></option>
                        </select><br />
                    </td>
                </tr>
                <tr>
                    <td class='name  name1'>出生年月</td>
                    <td>
                        <input type="date"><br />
                    </td>
                </tr>
                <tr>
                    <td class='name  name1'>住址</td>
                    <td>
                        <input type="text" name='address'><br /><br />
                    </td>
                </tr> 
            </table>   
            <input class="button button1" type="submit" value="注册新用户">
            <input class="button button2" type="reset" value="重置">
        </fieldset>
    </form>
</body>
</html>
  • mission accomplished
    Here Insert Picture Description
Published 16 original articles · won praise 56 · views 7409

Guess you like

Origin blog.csdn.net/qq_45027204/article/details/105150598