首页 > 开发 > CSS > 正文

CSS3过渡transition效果实例介绍

2024-07-11 08:33:03
字体:
来源:转载
供稿:网友

本文实例为大家分享了CSS3过渡transition效果,供大家参考,具体内容如下

效果图:

实现代码:

transition.html

XML/HTML Code复制内容到剪贴板
  1. <!DOCTYPE html>      <html lang="en">     
  2. <head>          <meta charset="UTF-8">     
  3.     <title>Transition</title>          <style>     
  4.         #block {                  width: 400px;     
  5.             height: 300px;                  background-color: #69C;     
  6.             margin: 0 auto;           
  7.             transition: background-color 1s, width 0.5s ease-out;                  -webkit-transition: background-color 1s, width 0.5s ease-out;     
  8.         }              #block:hover {     
  9.             background-color: red;                  width: 600px;     
  10.         }          </style>     
  11. </head>      <body>     
  12.     <div id="block">           
  13.     </div>      </body>     
  14. </html>    

transitionDemo.html

XML/HTML Code复制内容到剪贴板
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表