我相信有很多方法可以做到这一点。
这是使用 id 字段自定义 css 的示例。(我不擅长 CSS,希望有些显示更好的 CSS 代码。)
<style>
.my_form {
text-align:left;
}
#from dt {
float:left;
}
#from dd {
float:left;
}
#to {
float:left;
}
#to dt {
float:left;
}
#to dd {
float:left;
}
#city
{
clear:left;
}
</style>
<div class="my_form">
@inputText(formData("username"), '_id -> "name", '_label -> "Product name", 'placeholder->"Product name", '_help -> "")
@inputText(formData("username"), '_id -> "category", '_label -> "Product category", 'placeholder->"Product category", '_help -> "")
@inputText(formData("username"), '_id -> "from", '_label -> "Price range: from", 'placeholder->"from", '_help -> "")
@inputText(formData("username"), '_id -> "to", '_label -> "to", 'placeholder->"to", '_help -> "")
@inputText(formData("username"), '_id -> "city", '_label -> "City", 'placeholder->"City", '_help -> "")
</div>
然后你可以看到如下输出。
如果您构建自己的表单构造函数,那会更好。