In a drop down list, I need to add spaces in front of the options in the list. I am trying
<select> <option>  Sample</option> </select>
for adding two spaces but it displays no spaces. How can I add spaces before option texts?
To create extra spaces before, after, or in-between your text, use the (non-breaking space) extended HTML character.
Whitespace refers to characters which are used to provide horizontal or vertical space between other characters. Whitespace is often used to separate tokens in HTML, CSS, JavaScript, and other computer languages.
That's not work on option entry because it's a "system" generated drop-down menu but you can set the padding of a select. Just reset the box-sizing property to content-box in your CSS. The default value of select is border-box .
They're most often used for breaking the code on multiple lines and indenting lines to represent the nesting of elements. But, because these characters are important for people who read the code doesn't mean they're important for people who visit your web page.
Isn't  
the entity for space?
<select> <option> option 1</option> <option> option 2</option> </select>
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With