html使多行文字与多个文字区距离一致

在html中存在多行文字与多个<input type="text"|"checkbox"|"button"/>(或者其他类型)标签时,

由于文字的个数不能保持一致,从而导致后面的文字区的距离参差不齐

<html>
	<head>
		<title>调查问卷</title>
	</head>
	<body>
		<p>用户信息表</p>
		<form style = "border:1px soild red;">
			姓名:<input type = "text" /><br>
			年龄:<input type = "password" /><br>
			性别:男<input type = "radio"  >
			          女<input type = "radio" ><br>
			喜欢的电影:<input type = "password" /><br>
		         	个人特长:<input type = "password"/><br>
			爱好:<input type = "checkbox" />滑雪
			          <input type = "checkbox" />爬山
			          <input type = "checkbox" />游泳
			          <input type = "checkbox" />上网
			          <input type = "checkbox" /> 踢球 
		</form>
	</body>
</html>

代码效果:

这是由于字数差异导致文字区距离不一致。

解决办法:

<table border="1">

<tr>

<td></td>

</tr>

</table>

<html>
	<head>
		<title>调查问卷</title>
	</head>

	<body>
<table border="1">

			<p>用户信息表</p>
		<form style = "border:1px soild red;">
			<tr><td>姓名:</td><td><input type = "text" /></td></tr>
			<tr><td>年龄:</td><td><input type = "text" /></td></tr>
			<tr><td>性别:</td><td>
			          男<input type = "radio"  >
			          女<input type = "radio" ></td></tr>
			<tr><td>喜欢的电影:</td><td> <input type = "text"/></td></tr>
			<tr><td>	个人特长:</td><td><input type = "text" /></td></tr>
			<tr><td>爱好:</td><td>
			          <input type = "checkbox" />滑雪
			          <input type = "checkbox" />爬山
			          <input type = "checkbox" />游泳
			          <input type = "checkbox" />上网
			          <input type = "checkbox" /> 踢球 </td></tr>
		</form>
</tr>
</table>
		
	</body>
</html>

效果

这是右边的文字区以及放在了单独的表格里,左面文字的长度不会影响到文字区的位置

如果想去掉文字中的边框,把代码中的

<table border="1">

border="1" 直接删除即可

最终效果:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值