Html选择问题
我在 html 选择元素中有一些长文本。 当用户选择一个选项时,只要选择了,就会显示文本。
使其可用且清晰的最佳解决方案是什么?
示例
<select>
<option>very long text 1</option>
<option>very long text 2</option>
<option>very long text 3</option>
</select>
由于选择元素的长度,用户将看到类似“very long t”的内容。 是否有 jquery 脚本或一些技巧可以使整个文本可见?
I have some long text in a html select element.
When a user selects one option the text is displayed as long as the select is.
What is a best solution to make this usable and clear ?
Example
<select>
<option>very long text 1</option>
<option>very long text 2</option>
<option>very long text 3</option>
</select>
The user will see something like " very long t " because of the select element length.
Is there a jquery script or some trick to make the entire text visible ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通常会截断显示值(使用
...
后缀),这样它就不会弄乱下拉列表,然后我将实际的长值设置为选项title
:-I usually truncate the display value (using
...
suffix) so that it won't mess up the drop down list, then I set the actual long value as optiontitle
:-一种选择是用一组单选按钮/标签替换
或者,如果不需要在选择框中包含所有文本,您可以缩短选项上的文本 - 也许使用 javascript 来填充页面上的另一个区域,其中包含刚刚选择的选项的详细说明。
编辑 -
要加长
One option is to replace the
<select>
with a set of radio buttons / labels. You have more options for formatting the text, and it'll be easier to read.Or, if don't need to have all the text in the select box, you could shorten the text on the options - maybe use javascript to populate another area on the page with a detailed description of the option they just selected.
Edit --
To lengthen the
<select>
box, you can set its css width withstyle="width:250px;"
, or whatever width you need. (Or put the style in a class, obviously)