html中表格与表单的问题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html中表格与表单的问题相关的知识,希望对你有一定的参考价值。
<html>
<body>
<table width="100%" border="1">
<tr>
<td width="20%" height="120"> </td>
<td width="60%" height="120">
<form>
<table width="100%" height="120" border="1">
<tr>
<td width="40%" height="40">姓名</td>
<td width="60%" height="40"><input type="text" name="姓名"></input>
</tr>
<tr>
<td width="40%" height="40">密码</td>
<td widht="60%" height="40"><input type="password" name="密码"></input>
</tr>
<tr>
<td widht="100%" height="40" colspan="2" align="center">
<input type="button" value="注册"></input>
</td>
</tr>
</table>
</form>
</td>
<td width="20%" height="120"> </td>
</tr>
</table>
</body>
</html>
在加入<form></form>后中间的表格就会在下面多出来一点,取消<form></form>后又正常了,请问这是怎么回事。
<html>
<body>
<table width="100%" border="1">
<tr>
<td width="20%" height="120"> </td>
<td width="60%" height="120">
<form style="margin:0px; padding:0px;">
<table width="100%" height="120" border="1">
<tr>
<td width="40%" height="40">姓名</td>
<td width="60%" height="40"><input type="text" name="姓名"></input>
</tr>
<tr>
<td width="40%" height="40">密码</td>
<td widht="60%" height="40"><input type="password" name="密码"></input>
</tr>
<tr>
<td widht="100%" height="40" colspan="2" align="center">
<input type="button" value="注册"></input>
</td>
</tr>
</table>
</form>
</td>
<td width="20%" height="120"> </td>
</tr>
</table>
</body>
</html> 参考技术A 讲form标签的margin属性设置为0px即可
<html>
<body>
<table width="100%" border="1">
<tr>
<td width="20%" height="120"> </td>
<td width="60%" height="120">
<form style="margin:0px; padding:0px;">
<table width="100%" height="120" border="1">
<tr>
<td width="40%" height="40">姓名</td>
<td width="60%" height="40"><input type="text" name="姓名"></input>
</tr>
<tr>
<td width="40%" height="40">密码</td>
<td widht="60%" height="40"><input type="password" name="密码"></input>
</tr>
<tr>
<td widht="100%" height="40" colspan="2" align="center">
<input type="button" value="注册"></input>
</td>
</tr>
</table>
</form>
</td>
<td width="20%" height="120"> </td>
</tr>
</table>
</body>
</html>
HTML--表单(form)与表格(table)的组合练习
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>表单与表格的组合使用1</title>
</head>
<body>
<form action="">
<table border="1" cellpadding="30">
<tr align="center">
<td rowspan="4">总体信息</td>
<td colspan="2">用户注册</td>
</tr>
<tr align="right">
<td>用户名:</td>
<td><input type="text" placeholder="请输入用户名"></td>
</tr>
<tr align="right">
<td>密码:</td>
<td><input type="password" placeholder="请输入密码"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交">
<input type="reset" value="重置">
</td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>表单与表格的组合2</title>
</head>
<body>
<form action="">
<table border="0">
<tr>
<td align="right">电子邮箱: </td>
<td align="left"><input type="email" name="useremail"></td>
</tr>
<tr>
<td align="right">设置密码:</td>
<td align="left"><input type="password" name="pwd"></td>
</tr>
<tr>
<td align="right">真实姓名:</td>
<td align="left"><input type="text" name="turename"></td>
</tr>
<!-- -->
<tr>
<td align="right">性别:</td>
<td align="left"><input type="radio" name="gender" id="man"><label for="man">男</label>
<input type="radio" name="gender" id="woman"><label for="woman">女</label>
</td>
</tr>
<!-- -->
<tr>
<td align="right"> 生日:</td>
<td align="left"><select name="" id="">
<option value="" selected disabled>请选择身份</option>
<option value="">1999</option>
<option value="">2000</option>
<option value="">2001</option>
<option value="">2002</option>
<option value="">2003</option>
</select>年
<select name="" id="">
<option value=""selected disabled>..</option>
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
</select>月
<select name="" id="">
<option value="" selected disabled>..</option>
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
</select>日
</td>
</tr>
<tr>
<td> </td>
<td align="left"> <a href="#">为什么要填写我的生日?</a></td>
</tr>
<tr>
<td align="right">我现在:</td>
<td align="left"><select name="" id="">
<option value="">请选择身份</option>
</select>
(非常重要)
</td>
</tr>
<tr>
<td> </td>
<td align="left" colspan="2">
<input type="image" src="./picture/timg.jpg" width="50" alt="验证码">
<a href="#">看不清换一张?</a>
</td>
</tr>
<tr>
<td align="right">验证码:</td>
<td align="left"><input type="text" name="验证码"></td>
</tr>
<tr>
<td colspan="2" align="center">立即注册</td>
</tr>
</table>
</form>
</body>
</html>
以上是关于html中表格与表单的问题的主要内容,如果未能解决你的问题,请参考以下文章
使用CSS对HTML表单进行修饰,效果与excel表格类似,可以输入数据。