Select dropdown menu text split left and right?

╄→尐↘猪︶ㄣ 提交于 2019-12-01 19:53:51

<option> tags do not accept HTML content. You can only pad your selections with spaces to format them.

Alternately, there are plug-in replacements for <select> that use DIVs and ULs instead of <select> that give you more flexibility.

The easier will be to use non proportional (monospaced) font for those boxes and then using right count of nonbreaking spaces like this:

<style>
    select{
        font-family:monospace;
    }
</style>
<select>
    <option value="">First&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- A</option>
    <option value="">Car&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- B</option>
    <option value="">Black&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- C</option>
    <option value="">Super Duper&nbsp;- D</option>
</select>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!