Is there any possibility to align some text to left in combobox. For example

<select>
<option>Volvo         100</option>
<option>Saab          200</option>
<option>Mercedes  300</option>
<option>Audi          500</option>
</select>

I want numbers to be align to the left, but inserting spaces in the middle of text is always cut to one space. I found one fancy jquery plugin which can do that (not only that) but it is definitely too heavy. Any lighter solution?

2 answers

1
point

You can use the non-breaking space character &nbsp; that will prevent spaces from collapsing.

Answered over 8 years ago by Jacob Smith
paulp 0
0
points

Thanks, but this works only with fonts like monospace. For arial (or other) it give different result with aligning. Something like that:

as         10
a            100
bbb      200

Other suggestions?

Answered over 8 years ago by paulp
  • To be honest, I think your only option (no pun intended :) is to use the nbsp with a monospace font - if you are intent on using a SELECT control. Otherwise you will need to resort to using a TEXT INPUT and a strategically placed TABLE, at which point the complexity jumps! w3d over 8 years ago