admin管理员组文章数量:1328953
Is it possible to create a List Box, with List Items in Multiple Columns? I am aware of the alternatives, but I am wondering if this is possible in <select>
Is it possible to create a List Box, with List Items in Multiple Columns? I am aware of the alternatives, but I am wondering if this is possible in <select>
2 Answers
Reset to default 4No, it is not. The only allowed child-tag for select is option, which itself can only contain plain-text (but some browsers support some style-tags here, like b or i etc.).
The only pseudo-solution I can think of is using a fixed-width font for the list dropdown and then padding the content columns with spaces.
COL1_NAME | COL2_NAME
Some nice value | Another value
Another nice value| Second column
You can even try using "OPTGROUP" elements for the column names, but you have to be aware of different formattings applied by different browsers.
Update: For instance you can create a "multi-column" dropdown as seen here: http://twitpic./2lsuxx with the following HTML
<style type="text/css">* {font-family:Courier New;white-space:pre;}</style>
<select>
<option></option>
<optgroup label=" Col1 | Col2">
<option>Some nice value | Another value</option>
<option>Another nice value| Second column</option>
<optgroup>
</select>
本文标签: javascriptMultiColumn HTML List BoxStack Overflow
版权声明:本文标题:javascript - MultiColumn HTML List Box - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742252073a2440948.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论