我无法在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>
&#13;
答案 0 :(得分:0)
This plunkr表示您忘记在第二个字段集中的结束标记中添加结束标记。
<select name="country">
<option value=""></option>
<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>
</select>
答案 1 :(得分:-1)
你错过了一个可以尝试的选项标签
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<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 src="" id="preview" 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>
<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>
</select>
</fieldset>
<fieldset>
<legend>Your Indications</legend>
</fieldset>
</form>
</body>
</html>