Home  >  Article  >  Web Front-end  >  Sets how many seconds or milliseconds a CSS transition effect takes to complete

Sets how many seconds or milliseconds a CSS transition effect takes to complete

WBOY
WBOYforward
2023-09-15 22:49:021032browse

设置 CSS 过渡效果需要多少秒或毫秒才能完成

Use the transition-duration property in CSS to set the number of seconds or milliseconds required for the CSS transition effect to complete −

Example

Live Demonstration

<!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>

The above is the detailed content of Sets how many seconds or milliseconds a CSS transition effect takes to complete. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete