使用 CSS 斷行並換至下一行


使用 word-wrap 屬性斷行並換至下一行。你可以嘗試執行以下程式碼在 CSS 中實施 word-wrap 屬性

示例

動態演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 200px;
            border: 2px solid #000000;
         }
         div.b {
            word-wrap: break-word;
         }
      </style>
   </head>
   <body>
      <h2>word-wrap: break-word property</h2>
      <div class = "b"> ThisisdemotextThisisdemotext:
      thisisaveryveryveryveryveryverylongword.
      The long word wraps to the next line.</div>
   </body>
</html>

輸出

更新時間: 20-Jun-2020

736 次瀏覽

開啟你的 職業生涯

完成課程獲取認證

開始
廣告
© . All rights reserved.