如何在 CSS 中设置文本之间的空白?


要设置文本之间的空白,请使用 white-space 属性。可能的值为 normal、pre、nowrap。

示例

你可以尝试运行以下代码在 CSS 中设置文本之间的空白

<html>
   <head>
   </head>
   <body>
      <p style = "white-space:pre;">
         This text has a line break and the white-space pre setting tells the browser to honor
         it just like the HTML pre tag.</p>
   </body>
</html>

更新日期:2020 年 1 月 31 日

161 次浏览

开启你的职业生涯

通过完成课程获得认证

开始
广告