代码中没有多余的换行代码,使用text-align clear float来实现对齐
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="utf-8" xml:lang="utf-8">
<head>
<title>MySpace.cn</title>
<style type="text/css">
label {text-align:right;display:block;clear:left;width:200px;float:left;}
input {float:left;}
</style>
</head>
<body>
<form name="" action="" style="margin-left:10px;">
<label>姓名:</label>
<input id="" name="" type="" />
<label>年龄:</label>
<input id="" name="" type="" />
<label>城市:</label>
<input id="" name="" type="" />
</form>
</body>
</html>