<fieldset style="width: 400px;">
<legend><h2>Form Validation</h2></legend>
<form>
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="ime"></td>
</tr>
<tr>
<td>Username</TD>
<td><input type="text" name="username"></td>
</tr>
</table>
<input type="submit" value="Submit" name="send">
</form>
</fieldset>
我目前正在表格內制作表格......這對我來說是新的,因為我不知道該怎么做。上面是我試過的代碼,我需要這樣的東西。

如果有人能讓我走上正確的道路,我將不勝感激。
注意:如上圖所示,它需要有colspan3 個,因此它們的寬度可以相等。我用 just 做了一個完美的<form>,但我剛剛發現我們必須在桌子里面做...
uj5u.com熱心網友回復:
最簡單的方法是colgroup- 在那里您可以指定任何列應占用的表空間。對于您的示例,它會是這樣的:(請注意,我沒有感覺到所有需要的行)
<fieldset style="width: 400px;">
<legend><h2>Form Validation</h2></legend>
<form>
<table>
<colgroup>
<col width="40%"/>
<col width="60%"/>
</colgroup>
<tr>
<td>Name:</td>
<td><input type="text" name="ime"></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Re-type password:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input type="radio" id="male" name="gender" />
<label for="male">Male</label>
<input type="radio" id="female" name="gender" />
<label for="female">Female</label>
<input type="radio" id="other" name="gender" />
<label for="other">Other</label>
</td>
</tr>
<tr>
<td>Programming skills:</td>
<td>
<input type="checkbox" id="java"/>
<label for="java">Java</label>
<input type="checkbox" id="ruby"/>
<label for="ruby">Ruby</label>
<input type="checkbox" id="net"/>
<label for="net">.Net</label>
</td>
</tr>
</table>
<input type="submit" value="Submit" name="send">
</form>
</fieldset>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/360416.html
標籤:html 形式 html-table
