I need to allow users to insert leading spaces in their text. It appears that the default text field chopps off all leading spaces. I tried ckeditor and BUEeditor but they appear also to remove leading spaces, and I don't see any way to prevent that.

If possible, I don't want to use any text editor if possible.


  • That's how HTML works, and what the   character exists for. Trying to hold on to leading spaces is almost definitely the sign of an incorrect approach; styling should be done with CSS, not characters
    – Clive
    Mar 31, 2015 at 14:39
  • The users need to indent the text they insert the way they want, using spaces.
    – Yuri
    Mar 31, 2015 at 14:44
  • 1
    I understood the question, I was just saying that it's not a Drupal/Ckeditor/BUeditor/AnythingElseEditor issue. The display of multiple concurrent spaces is handled by HTML & CSS specs, as you've already discovered yourself from the looks of your answer
    – Clive
    Mar 31, 2015 at 15:16

1 Answer 1


A very simple solution I found using the class white-space: pre;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.