段落预格式化后保持正常文本字体
Maintain normal text font after paragraph pre format
我有以下代码,我正在尝试测试如何在我的网站上使用预格式。包含 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>
请帮我解决这个问题
删除 <pre>
元素,只需将样式添加到 CSS,如下所示:
<div style='width:200px; white-space: pre-wrap;'>
Your text here
</div>
此解决方案是否符合您的需要? <div style="white-space: pre-wrap;">content</div>
我在这里看到了 link
我有以下代码,我正在尝试测试如何在我的网站上使用预格式。包含 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>
请帮我解决这个问题
删除 <pre>
元素,只需将样式添加到 CSS,如下所示:
<div style='width:200px; white-space: pre-wrap;'>
Your text here
</div>
此解决方案是否符合您的需要? <div style="white-space: pre-wrap;">content</div>
我在这里看到了 link