Retain newlines in HTML but wrap text: possible?

前端 未结 5 2067
再見小時候
再見小時候 2020-12-17 01:14

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 retai

5条回答
  •  情深已故
    2020-12-17 02:00

    Try replacing any double spaces with    - which should work to make your look of double spaces come through.

    Crack all those new line and hard enters out with
    .

    Style the text output to make it look like a fixed-width with the font-family:

    font-family:monospace;
    

    You may need to size it up properly, something smaller than the surrounding text, but that will give you the look of a PRE, and what a plain text email will look like.

    Put it all in a DIV with a fixed with and that could be worth a look.

提交回复
热议问题