我的表单元素的标签不会出现

时间:2016-01-17 21:26:05

标签: html forms elements

我有一个问题,我的形式的元素之一标签没有出现,它坚持另一个元素,如胶水,但我不知道为什么。 有人可以看一下吗?问题是姓氏

`                                   

        </head>
            <body>
                <form name ="user_info" id="user_info" action="" method= "post">
                    <p>
                    <select name="addresses" id="addresses">
                    <option value="first">Mr.</option>
                    <option value="second">Mrs.</option>
                    <option value="third">Ms.</option>
                    <option value="fourth">Miss</option>
                    <option value="fifth">Dr.</option>
                    </select>
                    </p>

                    <p>
                    <label for="sex">Please select your sex</label>
                    <select name="sex" id="sex">
                    <option value="first">male</option>
                    <option value="second">female</option>
                    </p>



                    <p>
                    <label for="last_name">Last name:</label>
                    <input type="text" name="last_name" id="last_name" size="30" maxlength="80">
                    </p>


                    <p>
                    <label for="first_name">First name:</label>
                    <input type="text" name="first_name" id="first_name" size="30" maxlength="80">
                    </p>

                    <p>
                    <label for="email">E-Mail Address:</label>
                    <input type="text" name="email" id="email" size="30" maxlength="80">
                    </p>

                    <p>
                    <label for="password">Password:</label>
                    <input type="password" name="password" id="password"  size="10"     maxlength="20">   
                    </p>

                    <p>
                    <label for="interests">What are your likes?</label>
                    <select name="interests" id="interests">
                    <option value="first">Literature</option>
                    <option value="second">Programming</option>
                    <option value="third">Linguistics</option>
                    <option value="fourth">History</option>
                    <option value="fifth">Biology</option>
                    </select>
                    </p> 

                    <p>
                    <label for="newsletter">Would you like to subscribe to our newsletter?</label>
                    <select name="newsletter" id="newsletter">
                    <option value="first">Yes</option>
                    <option value="second">No</option>
                    </select>
                    </p>

                    <p>
                    <label for="user_comments">Kindly add any comment you may have here</label>
                    <textarea name="user_comments" id="user_comments" cols="40" rows="5">My default text</textarea>
                    </p>

                    <input type="submit" name="submit_button"     id="submit_button" value="Submit">

                </form>



            </body>
    </html>´  

2 个答案:

答案 0 :(得分:2)

这是因为你忘了结束你的SELECT。为了澄清,您需要在最后一个选项之后添加</select>

<select name="sex" id="sex">
    <option value="first">male</option>
    <option value="second">female</option>
</select>

答案 1 :(得分:0)

<p>
<label for="sex">Please select your sex</label>
<select name="sex" id="sex">
<option value="first">male</option>
<option value="second">female</option>
</p>

这是你的问题。你忘了关闭选择。它应该是这样的:

<p>
<label for="sex">Please select your sex</label>
<select name="sex" id="sex">
<option value="first">male</option>
<option value="second">female</option>
</select>
</p>