使用 CSS 在元素內部停用文字換行


若要停用元素內部的文字換行,請使用 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>

更新時間:2020 年 6 月 21 日

492 次瀏覽

開啟您的 職業生涯

完成課程並獲得認證

開始學習
廣告