我有一个文本,我想用线条来显示它
像这样没有<br>
标签。
例子:
hello.
how are you ?
fine !
不是这样的:
hello. how are you ? fine !
有人可以帮助我吗?
最佳答案
您应该使用pre
标签。与 br
标签相比,这样做的好处之一是它可以编写更少的字符。使用 br
,您将不得不使用其中的大约五个。这会导致文件变大。虽然这个差异很小,但它是一个微小的改进。
The HTML
pre
element defines preformatted text.The text inside a pre element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:
您可以使用 style
属性保留原始样式。根据您想要的字体大小和字体系列,您可以执行类似的操作。
<pre style="font-size: 16px, font-family: Verdana" >hello.
how are you ?
fine !
not like this :
hello. how are you ? fine !
someone can help me ?</pre>
关于html - 如何在没有 <br> 的情况下显示带有线条的段落,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35688203/