使用 CSS 禁用元素内的文本换行

cssweb developmentfront end technology更新于 2024/3/24 9:16:17

要禁用元素内的文本换行,请使用 white-space 属性。您可以尝试运行以下代码来实现 white-space 属性

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         p {
            white-space: nowrap;
         }
      </style>
   </head>
   <body>
      <p>
         This is demo text. This is demo text.
         This is demo text. This is demo text.
         This is demo text. This is demo text.
         This is some text. This is demo text.
      </p>
   </body>
</html>

相关文章


有用资源