【发布时间】:2016-04-25 08:44:41
【问题描述】:
我无法在 HTML 表单中创建超过 2 个字段集。代码似乎正确。它适用于第一个和第二个,但第三个 <fieldset> 不会出现。
这是我的代码:
<body>
<h1>Please Enter Your Details</h1>
<form method="post" action="destination">
<fieldset>
<legend>Your face</legend>
<label for="Your Image">Your Image</label>
<input type="File" id="Your Image">
<img id="preview" src="" alt="">
</fieldset>
<fieldset>
<legend>Your General Details</legend>
<label for="name">Name:</label>
<input type="text" id="name" placeholder="Your Full Name">
<br>Gender:
<input type="radio" name="gender" value="Male">Male
<input type="radio" name="gender" value="Female">Female
<br>
<label for="age">Age:</label>
<input type="number" id="age" placeholder="18">
<br>Date of Birth:
<input type="date" name="birthdate">
<br>Favorite color:
<input type="color" name="color">
<br>Which Country:
<select name="country">
<option value="">
<option value="USA">USA</option>
<option value="UK">United Kingdom</option>
<option value="France">France</option>
<option value="Canada">Canada</option>
<option value="Japan">Japan</option>
<option value="Germany">Germany</option>
</fieldset>
<fieldset>
<legend>Your Indications</legend>
</fieldset>
</form>
</body>
【问题讨论】:
-
元素
id,因此是for属性,不能包含空格,并且您从未关闭您的<select>元素。但除此之外,我不明白为什么这不起作用。 -
除了一些值得注意的例外,您应该始终“关闭您打开的内容”,能够可视化需要关闭的内容的一种非常常见的方法是使用缩进,不要偷懒思考太浪费时间了,今天就开始缩进吧。
-
你能解决你的问题用户吗?