Html 职位<;表格:单选按钮>;垂直地
我正在使用Spring MVCHtml 职位<;表格:单选按钮>;垂直地,html,css,jsp,spring-mvc,Html,Css,Jsp,Spring Mvc,我正在使用Spring MVC显示单选按钮: <form:radiobuttons path="selection" items="${arraySelection}" /> 但是,它会水平显示它们。生成的HTML如下所示: <span> <input id="selection1" type="radio" value="0"" name="selection"> <label for"selection1">Off</label
显示单选按钮:
<form:radiobuttons path="selection" items="${arraySelection}" />
但是,它会水平显示它们。生成的HTML如下所示:
<span>
<input id="selection1" type="radio" value="0"" name="selection">
<label for"selection1">Off</label>
</span>
<span>
<input id="selection2" type="radio" value="1"" name="selection">
<label for"selection2">On</label>
</span>
在…上
如何垂直显示它们?您可以将默认包装(即
)更改为其他可以更好操作的内容,例如
您可以使用该属性更改包装器:
<ul>
<form:radiobuttons path="selection" items="${arraySelection}" element="li" />
</ul>
然后,只需按照您的意愿设计它的样式:
ul.verticalRadios {
list-style-type: none;
/* or whatever */
}
...
<ul class="verticalRadios">
<form:radiobuttons path="selection" items="${arraySelection}" element="li" />
</ul>
ul垂直无线电{
列表样式类型:无;
/*或者别的什么*/
}
...
只是一些建议,这取决于具体情况,有时只能使用元素“br”,而不需要额外的css 另一个解决方案,没有额外的css文件
<ul style="list-style: none">
<form:radiobuttons path="selection" items="${arraySelection}" element="li" />
</ul>
请不要将JSTL与Spring MVC中的任意第三方JSP标记库混淆。要了解JSTL的真正含义,请仔细阅读我的简介,从问题中删除了不相关的[JSTL]
标记(并清理了一些蹩脚的英语/术语)。
<ul style="list-style: none">
<form:radiobuttons path="selection" items="${arraySelection}" element="li" />
</ul>