Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 156845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:23:55+00:00 2026-05-11T10:23:55+00:00

I came across an interesting problem today. I have a text email I’m sending

  • 0

I came across an interesting problem today. I have a text email I’m sending from a Web page. I’m displaying a preview and wanted to put the preview in a fixed font retaining the white space since that’s the way the plain text email will appear.

Basically I want something that’ll act like Notepad: the newlines will signal a newline but the text will otherwise wrap to fit inside it’s container.

Unfortunately this is proving difficult unless I’m missing something really obvious. I’ve tried:

  1. CSS white-space: pre. This retains white space but doesn’t wrap lines of text so they go out the borders on long lines;

  2. Styling a textarea element to be read only with no border so it basically apepars like a div. The problem here is that IE doesn’t like 100% heights on textareas in strict mode. Bizarrely it’s OK with them in quirks mode but that’s not an option for me.

  3. CSS white-space: prewrap. This is CSS 2.1 so probably not widely supported (I’m happy if it’s supported in IE7 and FF3 though; I don’t care about IE6 for this as its an admin function and no one will be running IE6 that will use this page).

Any other suggestions? Can this really be that hard?

edit: can’t comment so more info. Yes at the moment I am using font Courier New (i.e. fixed width) and using a regex on the server side to replace the newlines with <br> tags but now I need to edit the content and it just strikes me as awkward that you need to strip out and add the <br>s to make it work.

is there no better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:23:56+00:00Added an answer on May 11, 2026 at 10:23 am

    Try

    selector {   word-wrap: break-word; /* IE>=5.5 */   white-space: pre; /* IE>=6 */   white-space: -moz-pre-wrap; /* For Fx<=2 */   white-space: pre-wrap; /* Fx>3, Opera>8, Safari>3*/ } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I came across an interesting problem today. We have a WCF web service
I came across an interesting problem recently. In an ASP.NET Master Page, I have
I came across an interesting problem today whilst implementing a feature into a dynamic
I have came across very interesting problem which I think it's on Salesforce's end
I have came across a very interesting problem. I have a UILabel and a
I came across an interesting question today where I have two methods that, at
I came across an interesting problem today. I was altering a stored procedure and
I came across an interesting situation today: I have a small app with a
I just came across the interesting problem of trying to trim the leading zeroes
I just came across an interesting LogCat entry: 06-28 08:43:25.616 I Web Console 5075

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.