如何在 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>

更新于: 31-01-2020

162 次浏览

启动你的职业

完成课程并获得认证

立即开始
广告
© . All rights reserved.