Search code examples
htmlcsspre

Maintain normal text font after paragraph pre format


I have the following code which I'm trying to test on how to use pre format on my site. After including the pre , the font changes and the lines does not break to fit on the 200px division . I want to maintain the default font size, style and family. NB: I don't want to use overflow method . I would like to have an output like this

"Sometimes it is very hard to code but by
 circumstance you find yourself struggling 
to fit in the game .
Awesome feelings come and disappear.
Niggas say this game is for the patient hearts.
 You nigga is this true??
  Nigga love style
 keep in touch with us at any given time"

plus the default text font

<html>
    <head>
       <title>Test</title>
    <style>
    {
      pre{
    font-family: monospace;
    text-wrap: unrestricted;
    }
    }
    </style>
    </head>
    <body>
    <div style='width:200px;'>
      <pre>Sometimes it is very hard to code but by circumstance you find yourself struggling to fit in the game .Awesome feelings come and disappear.Niggas say this game is for the patient hesrts .. You nigga is this true??
    Nigga love style
    keep in touch with us at any given time</pre>
    </body>
    </html>

please help me solve this problem


Solution

  • Would this solution fit your need? <div style="white-space: pre-wrap;">content</div>

    I've seen that here link