設定 CSS 過渡效果完成所需的時間(秒或毫秒)


在 CSS 中使用 transition-duration 屬性設定 CSS 過渡效果完成所需的時間(秒或毫秒)−

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 150px;
            background: blue;
            transition-property: height;
            transition-duration: 2s;
         }
         div:hover {
            height: 200px;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <p>Hover over the below box to change its height.</p>
      <div></div>
   </body>
</html>

更新於: 02-7 月-2020

217 次瀏覽

啟動你的 事業

完成課程後,獲取認證

開始
廣告
© . All rights reserved.