serhatozgel serhatozgel - 1 year ago 68
HTML Question

How do I put a space character before option text in a HTML select element?

In a drop down list, I need to add spaces in front of the options in the list. I am trying


for adding two spaces but it displays no spaces. How can I add spaces before option texts?

Answer Source

Isn't &#160 the entity for space?

<option>&#160;option 1</option>
<option>    option 2</option>

Works for me...


Just checked this out, there may be compatibility issues with this in older browsers, but all seems to work fine for me here. Just thought I should let you know as you may want to replace with &nbsp;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download