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

<pre><code>&lt;select&gt;
&lt;option&gt;&amp;#32;&amp;#32;Sample&lt;/option&gt;
&lt;/select&gt;
</code></pre>

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

[{'answer_id': 25754, 'author': 'Gishu', 'author_id': 1695, 'author_profile': 'https://Stackoverflow.com/users/1695', 'pm_score': 2, 'selected': False, 'text': '<pre><code>&amp;nbsp;\n</code></pre>\n\n<p>Can you try that? Or is it the same?</p>\n'}, {'answer_id': 25758, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': 6, 'selected': True, 'text': "<p>Isn't <code>&amp;#160</code> the entity for space?</p>\n<pre><code>&lt;select&gt;\n&lt;option&gt;&amp;#160;option 1&lt;/option&gt;\n&lt;option&gt;    option 2&lt;/option&gt;\n&lt;/select&gt;\n</code></pre>\n<p>Works for me...</p>\n<h3>EDIT:</h3>\n<p>Just checked this out, there <em>may</em> 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 <code>&amp;nbsp;</code></p>\n"}, {'answer_id': 25759, 'author': 'Matt Sheppard', 'author_id': 797, 'author_profile': 'https://Stackoverflow.com/users/797', 'pm_score': 4, 'selected': False, 'text': '<p>I think you want <code>&amp;nbsp;</code> or <code>&amp;#160;</code></p>\n\n<p>So a fixed version of your example could be...</p>\n\n<pre><code>&lt;select&gt;\n  &lt;option&gt;&amp;nbsp;&amp;nbsp;Sample&lt;/option&gt;\n&lt;/select&gt;\n</code></pre>\n\n<p>or</p>\n\n<pre><code>&lt;select&gt;\n  &lt;option&gt;&amp;#160;&amp;#160;Sample&lt;/option&gt;\n&lt;/select&gt;\n</code></pre>\n'}, {'answer_id': 25840, 'author': 'Brian Warshaw', 'author_id': 1344, 'author_profile': 'https://Stackoverflow.com/users/1344', 'pm_score': 2, 'selected': False, 'text': "<p>I'm nearly certain you can accomplish this with CSS padding, as well. Then you won't be married to the space characters being hard-coded into all of your <code>&lt;option&gt;</code> tags.</p>\n"}, {'answer_id': 25888, 'author': 'Ross', 'author_id': 2025, 'author_profile': 'https://Stackoverflow.com/users/2025', 'pm_score': 2, 'selected': False, 'text': '<p>@Brian</p>\n\n<blockquote>\n  <p>I\'m nearly certain you can accomplish this with CSS padding, as well. Then you won\'t be married to the space characters being hard-coded into all of your  tags.</p>\n</blockquote>\n\n<p>Good thinking - but unfortunately it doesn\'t work in (everyone\'s favourite browser...) IE7 :-(</p>\n\n<p>Here\'s some code that will work in Firefox (and I assume Op/Saf).</p>\n\n<pre><code>&lt;select&gt;\n    &lt;option style="padding-left: 0px;"&gt;Blah&lt;/option&gt;\n        &lt;option style="padding-left: 5px;"&gt;Blah&lt;/option&gt;\n            &lt;option style="padding-left: 10px;"&gt;Blah&lt;/option&gt;\n    &lt;option style="padding-left: 0px;"&gt;Blah&lt;/option&gt;\n        &lt;option style="padding-left: 5px;"&gt;Blah&lt;/option&gt;\n&lt;/select&gt;\n</code></pre>\n'}, {'answer_id': 3685564, 'author': 'John', 'author_id': 30006, 'author_profile': 'https://Stackoverflow.com/users/30006', 'pm_score': 3, 'selected': False, 'text': '<p>As Rob Cooper pointed out, there are some compatibility issues with older browsers (IE6 will display the actual letters "&amp; nbsp;"</p>\n\n<p>This is how I get around it in ASP.Net (I don\'t have VS open so I\'m not sure what characters this actually gets translated to):</p>\n\n<pre><code>Server.HtmlDecode("&amp;nbsp;") \n</code></pre>\n'}, {'answer_id': 4033142, 'author': 'Smolla', 'author_id': 488794, 'author_profile': 'https://Stackoverflow.com/users/488794', 'pm_score': 3, 'selected': False, 'text': '<p>You can also press alt+space (on mac) for a non-breaking space. I use it for a Drupal module because Drupal decodes html entities.</p>\n'}, {'answer_id': 5092184, 'author': 'user630071', 'author_id': 630071, 'author_profile': 'https://Stackoverflow.com/users/630071', 'pm_score': 1, 'selected': False, 'text': '<p><code>Server.HtmlDecode("&amp;nbsp;")</code> is the only one that worked for me.</p>\n\n<p>Otherwise the chr are printed as text.</p>\n\n<p>I tried to add the padding as a Attribute for the listitem, however it didnt affect it.</p>\n'}, {'answer_id': 10986354, 'author': 'Alain Holloway', 'author_id': 1449740, 'author_profile': 'https://Stackoverflow.com/users/1449740', 'pm_score': 2, 'selected': False, 'text': '<p>Just use char 255 (type <kbd>Alt</kbd>+<kbd>2</kbd>+<kbd>5</kbd>+<kbd>5</kbd> on your numeric keypad) with a monospace font like <code>Courier New</code>.</p>\n'}, {'answer_id': 17855282, 'author': 'Riyaz Hameed', 'author_id': 1570636, 'author_profile': 'https://Stackoverflow.com/users/1570636', 'pm_score': 5, 'selected': False, 'text': '<p>Use <strong>\\xA0</strong> with String.\nThis Works Perfect while binding C# Model Data to a Dropdown...</p>\n\n<pre><code>  SectionsList.ForEach(p =&gt; { p.Text = "\\xA0\\xA0Section: " + p.Text; });\n</code></pre>\n'}, {'answer_id': 23674381, 'author': 'Shahid Riaz Bhatti', 'author_id': 3640138, 'author_profile': 'https://Stackoverflow.com/users/3640138', 'pm_score': 1, 'selected': False, 'text': '<p>I was also having the same issue and I was required to fix this as soon as possible. Though I googled a lot, I was not able to find a quick solution.</p>\n\n<p>Instead I used my own solution, though I am not sure if its appropriate one, it works in my case and exactly which I was required to do.</p>\n\n<p>So when you add an ListItem in dropdown and you want to add space then use the following:-</p>\n\n<p>Press <kbd>ALT</kbd> and type <code>0160</code> on your numeric keypad, so it should be something like <code>ALT+0160</code>. It will add a space.</p>\n\n<pre><code>ListItem("ALT+0160 ALT+0160 TEST", "TESTVAL")\n</code></pre>\n'}, {'answer_id': 24847659, 'author': 'dabobert', 'author_id': 1332316, 'author_profile': 'https://Stackoverflow.com/users/1332316', 'pm_score': 3, 'selected': False, 'text': '<p>i tried multiple things but the only thing that worked for me was to use javascript.  just notice that i\'m using the unicode code for space rather than the html entity, as js doenst know a thing about entities</p>\n\n<pre><code>$("#project_product_parent_id option").each(function(i,option){\n  $option = $(option);\n  $option.text($option.text().replace(/─/g,\'\\u00A0\\u00A0\\u00A0\'))\n});\n</code></pre>\n'}, {'answer_id': 47038372, 'author': 'Busch4Al', 'author_id': 5975805, 'author_profile': 'https://Stackoverflow.com/users/5975805', 'pm_score': -1, 'selected': False, 'text': "<p>I tried several of these examples, but the only thing that worked was using javascript, much like dabobert's, but not jQuery, just plain old vanilla javascript and spaces:</p>\n\n<pre><code>for(var x = 0; x &lt; dd.options.length; x++)\n{\n    item = dd.options[x];\n    //if a line that needs indenting\n    item.text = '     ' + item.text; //indent\n}\n</code></pre>\n\n<p>This is IE only. IE11 in fact. Ugh.</p>\n"}, {'answer_id': 47790035, 'author': 'Jay', 'author_id': 6703661, 'author_profile': 'https://Stackoverflow.com/users/6703661', 'pm_score': -1, 'selected': False, 'text': '<p>1.Items Return to List</p>\n\n<p>2.Foreach loop in list</p>\n\n<p>3..</p>\n\n<pre><code>foreach (var item in q)\n{\n    StringWriter myWriter = new StringWriter();\n\n    myWriter.Lable = HttpUtility.HtmlDecode(item.Label.Replace(" ", "&amp;nbsp;"));\n}\n</code></pre>\n\n<p>This work for me!!!</p>\n'}, {'answer_id': 57414845, 'author': 'Diogo Toscano', 'author_id': 4047580, 'author_profile': 'https://Stackoverflow.com/users/4047580', 'pm_score': 1, 'selected': False, 'text': "<p>In PHP you can use html_entity_decode:</p>\n\n<pre><code>obj_dat.options[0] = new Option('Menu 1', 'Menu 1');\nobj_dat.options[1] = new Option('&lt;?php echo html_entity_decode('&amp;nbsp;&amp;nbsp;&amp;nbsp;'); ?&gt;Menu 1.1', 'Menu 1.1');\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/25752', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/31505/']