<!DOCTYPE html> <html> <head> <title>transiton(过渡)</title> <meta charset="utf-8"> <style type="text/css"> .div_tran{ width: 130px; height: 100px; /*rgba中的a是透明度(范围0~1)*/ background: rgba(165,237,15,0.5); /*background: rgb(165,237,15);*/ /*css的透明属性opacity(范围0~1)*/ opacity: .3; color: #000; /*-webkit-transition:width 2s,height 3s,background,opacity 2.5s; */ -webkit-transition:all 3s; } .div_tran:hover{ width: 200px; height: 200px; background: rgb(28,227,209); opacity: 1; color: red; } /* span{ opacity: 1; position: relative; top: -100px; }*/ </style> </head> <body> <div class="div_tran"> transiton(过渡) </div>
<!-- <span>transiton(过渡)</span> --> </body> </html>