簡體   English   中英

如何在沒有 br 標簽的情況下插入換行符

[英]How to insert a line break without a br tag

如何在沒有<br>標簽的情況下在單個段落中插入換行符? 見下文:

在此處輸入圖片說明

您可以使用 HTML 在<pre>標記</pre>內按 Enter 鍵。

在 CSS 中,您可以使用white-space:prewhite-space:pre-wrap

在編程中使用換行符\\n

JS Bin 示例: http : //jsbin.com/simeri/edit?html,output

<p style='white-space:pre-wrap;text-align:center;font:bold 130% sans-serif'>
    Google Fonts. Hundreds of free, open-source fonts optimized for the web...
    Search or browse hundreds of font families, then add the ones you like to your ..
</p>

您可以使用 css word-wrap 屬性,如下所示:

  width: 200px; /*width of area after you want line break*/
  word-wrap: break-word; /*break down the paragraph/text*/

或在您的代碼中動態使用 \\n。

<!DOCTYPE html><html><body>
<p style=' white-space: pre-line;text-align:center;font:bold 100% sans-serif'>
Google Fonts. Hundreds of free, open-source fonts optimized for the web...
  Search or browse hundreds of font families, then add the ones you like to your ..
</p>
</body></html>

你能用&nbsp..嗎?

    <p>&nbsp;</p>

這就是 Canvas LMS 中的工作原理...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM