CSS Transition 属性

cssweb developmentfront end technology更新于 2025/6/21 2:52:17

使用 CSS transition 属性将所有四个过渡属性设置为一行。您可以尝试运行以下代码来使用 transition 属性 −

示例

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

相关文章


有用资源