Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 段落预格式化后保持正常文本字体_Html_Css_Pre - Fatal编程技术网

Html 段落预格式化后保持正常文本字体

Html 段落预格式化后保持正常文本字体,html,css,pre,Html,Css,Pre,我有以下代码,我正试图测试如何在我的网站上使用预格式化。包含pre后,字体会发生变化,线条不会断开以适合200px分区。我想保持默认的字体大小、样式和系列。 注意:我不想使用溢出方法。 我想有一个这样的输出 "Sometimes it is very hard to code but by circumstance you find yourself struggling to fit in the game . Awesome feelings come and disappear. Ni

我有以下代码,我正试图测试如何在我的网站上使用预格式化。包含pre后,字体会发生变化,线条不会断开以适合200px分区。我想保持默认的字体大小、样式和系列。 注意:我不想使用溢出方法。 我想有一个这样的输出

"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"
加上默认的文本字体

<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>

试验
{
前{
字体系列:monospace;
文本换行:不受限制;
}
}
有时很难编写代码,但根据具体情况,你会发现自己很难融入到游戏中。可怕的感觉来了又消失了。黑鬼说这个游戏是给病人玩的。。你这黑鬼是真的吗??
黑人爱情风格
随时与我们保持联系
请帮助我解决此问题

删除
元素,只需将样式添加到CSS中,如下所示:


你的文字在这里
删除
元素,只需将样式添加到CSS中,如下所示:


你的文字在这里

此解决方案是否适合您的需要<代码>内容


我在这里看到了

此解决方案是否适合您的需要<代码>内容


我在这里看到了

你想要预标签做什么?您是否尝试过将字体系列从monospace更改为其他字体?您想要预标记做什么?您是否尝试过将字体系列从monospace更改为其他字体?另外:尝试根据其语义使用HTML标记。您似乎只将给定的结构用于设计目的(因此:没有语义意义),因此,div(有时是span)是一种选择。关于pre的语义:另外:尝试根据其语义使用HTML标记。您似乎只将给定的结构用于设计目的(因此:没有语义意义),因此,div(有时是span)是一种选择。关于pre的语义:
<div style='width:200px; white-space: pre-wrap;'>
      Your text here
</div>