我想设计一个使用 Struts 2 在同一行显示用户 ID 和密码的网页。
如何在不使用的情况下管理它theme='simple'
?
<%@taglib uri="/struts-tags" prefix="s" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%><html>
<head>
</head>
<body>
<s:form action="Register.action">
<s:textfield name="uid" label="User Name"/>
<s:password name="pass" label="Password"/>
</s:form>
</div>
上述源码:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form id="Register" action="Register.action" method="post">
<table class="wwFormTable">
<tr>
<td class="tdLabel">
<label for="Register_uid" class="label">User Name:</label>
</td>
<td>
<input type="text" name="uid" value="" id="Register_uid"/>
</td>
</tr>
<tr>
<td class="tdLabel">
<label for="Register_pass" class="label">Password:</label>
</td>
<td>
<input type="password" name="pass" id="Register_pass"/>
</td>
</tr>
</table>
</form>
</body>
</html>
根据您生成的HTML,您可以应用CSS规则display:inline-block;
to the <tr>
您的餐桌:
input{width:100px;} /* needed only to fit in the "Run code snippet" box */
.wwFormTable tr {
display: inline-block;
}
<table class="wwFormTable">
<tr>
<td class="tdLabel">
<label for="Register_uid" class="label">User Name:</label>
</td>
<td>
<input type="text" name="uid" value="" id="Register_uid" />
</td>
</tr>
<tr>
<td class="tdLabel">
<label for="Register_pass" class="label">Password:</label>
</td>
<td>
<input type="password" name="pass" id="Register_pass" />
</td>
</tr>
</table>
也就是说,我有一种感觉,您可能不知道您可以使用simple
单一元素的主题
<s:form action="Register.action">
<s:textfield name="uid" label="User Name" theme="simple" />
<s:password name="pass" label="Password" theme="simple" />
</s:form>
或在单一表格上
<s:form action="Register.action" theme="simple">
<s:textfield name="uid" label="User Name" />
<s:password name="pass" label="Password" />
</s:form>
不放弃使用XHTML
整个应用程序的主题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)