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

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

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


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

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