CSS overflow: auto


CSS overflow: auto,只在需要時新增捲軸,這與 overflow:scroll 不同。你可以嘗試執行以下程式碼來實現CSS overflow: auto 屬性

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            background-color: orange;
            width: 250px;
            height: 45px;
            border: 2px solid blue;
            overflow: auto;
         }
      </style>
   </head>
   <body>
      <h1>Heading</h1>
      <div>Overflow property used here. This is a demo text to show the working of CSS overflow: auto. This won't hide the content. A scrollbar would be visible, only if needed.</div>
   </body>
</html>

輸出

更新於: 2020 年 6 月 22 日

364 次瀏覽

開啟你的 職業生涯

完成課程即可獲得認證

開始
廣告
© . All rights reserved.