CSS - white-space: pre with <option> (spaces in option)

6 points
Created by:

The article topic is called: CSS - white-space: pre with <option> (spaces in option)
But it is impossible to get pre effect with styles - there is some trick: use &nbsp; code in HTML to fill spaces.

white-space: pre with <option> solution
white-space: pre with <option> solution

Practical example:

// ONLINE-RUNNER:browser;

<!doctype html>
    <label>Layout: </label>
    <select style="font-family: monospace">
      <option value="files">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Details</option>
      <option value="details">Files&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
      <option value="files+details">Files + Details</option>
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.


Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂