使用 CSS 懸停在元素上時顯示溢位內容


為了在元素上懸停時顯示溢位內容,你可以嘗試執行以下程式碼

範例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div.demo {
            white-space: nowrap;
            width: 180px;
            overflow: hidden;
            border: 2px solid blue;
        }
         div.demo:hover {
            text-overflow: inherit;
            overflow: visible;
         }
      </style>
   </head>
   <body>
      <p>Hover to see the complete text below:</p>
      <br>
      <div class = "demo" style = "text-overflow:clip;">Demo Text that will hide in this box.</div>
   </body>
</html>

更新於:2020 年 6 月 23 日

2000+ 瀏覽次數

開啟你的 事業

透過完成本課程獲得認證

開始學習
廣告
© . All rights reserved.