Dev Tip: Preserve whitespace in HTML without using (nbsp)

If you want to preserve whitespace within an HTML element (div/span) without using non-breaking spaces (and therefore breaking word-wrap), add the following property to the CSS style(s) for that element:


There are more options available for this property as well:


  1. ascorpio says:

    Cool! Saved my time.

  2. sagar says:

    Thanks. Really helped me good time.

  3. Frank says:

    Thanks! This is really helpful. At first I thought I had problems with ColdFusion not reading the spaces from the DB, then I thought it may have been the DB, when all along it was HTML rules!!

  4. Thanks. Really helpful. 🙂

  5. I love canon, I still get so much use out of my 1d classic

  6. Natalie Kurd says:

    This website said pre-wrap is not recognized by IE ( Unfortunately, I am working on IE. Any suggestion? Thanks.

    1. willwm says:

      Looks like this might help you out:

Leave a Comment

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s