选择下拉菜单文本左右拆分? [英] Select dropdown menu text split left and right?
本文介绍了选择下拉菜单文本左右拆分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不确定是否可以这样做,但是我可以分割选项标签中的文本吗?
Not sure if this can be done but can I split the text in the option tags?
示例,正常样式:
<select>
<option value="">First - A</option>
<option value="">Car - B</option>
<option value="">Black - C</option>
<option value="">Super Duper - D</option>
</select>
如何使它看起来像这样:
How can I get it to look like this:
<select>
<option value="">First - A</option>
<option value="">Car - B</option>
<option value="">Black - C</option>
<option value="">Super Duper - D</option>
</select>
我尝试在选项标签中添加一个span标签,但这没用
I've tried added a span tag nested in the option tag but that didn't work
推荐答案
<option>
标记不接受HTML内容.您只能用空格填充选择框以格式化它们.
<option>
tags do not accept HTML content. You can only pad your selections with spaces to format them.
或者,<select>
的插件替代使用DIV
s和UL
s代替了<select>
,从而为您提供了更大的灵活性.
Alternately, there are plug-in replacements for <select>
that use DIV
s and UL
s instead of <select>
that give you more flexibility.
这篇关于选择下拉菜单文本左右拆分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文