css3技术

我想跟代码谈谈(2)

字号+ 作者:H5之家 来源:H5之家 2015-09-09 14:07 我要评论( )

HTML代码: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN html xmlns=headmeta http-equiv=Content-Type content=text/html; charset=utf-8 /titleCSS3动画/titlelink type=text/css rel=styleshe

HTML代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CSS3动画</title> <link type="text/css" rel="stylesheet" href="animation.css" /> </head> <body> <div class="rotate">rotate</div> <div class="scale">scale</div> <div class="translate">translate</div> <div class="skew">skew</div> <div class="origin">origin</div> <div class="single">single property</div> <div class="whole">whole property</div> <div class="resume">change & resume</div> <div class="animation">animation</div> </body> </html> 

CSS代码:

animation.css

div { width: 80px; height: 30px; line-height: 30px; text-align: center; background: #06F; color: #fff; font-family: Arial, Helvetica, sans-serif; -webkit-border-radius: 10px; margin: 5px; } .rotate { -webkit-transform: rotate(0deg); } .rotate:hover { -webkit-transform: rotate(90deg); } .scale { -webkit-transform: scale(1); } .scale:hover { -webkit-transform: scale(1.5); } .translate { -webkit-transform: translate(0px, 0px); } .translate:hover { -webkit-transform: translate(50px, 50px); } .skew { -webkit-transform: skew(0); } .skew:hover { -webkit-transform: skewY(20deg); } .origin { -webkit-transform-origin: top left; -webkit-transform: rotate(0); } .origin:hover { -webkit-transform: rotate(45deg); } .single { width: 150px; } .single:hover { background: #f00; width: 200px; height: 100px; line-height: 100px; -webkit-transition-property: background; -webkit-transition-duration: 2s; } .whole { width: 150px; } .whole:hover { width: 200px; height: 100px; line-height: 100px; background: #f00; -webkit-transition-duration: 2s; } .resume { width: 150px; -webkit-transition-duration: 2s; } .resume:hover { width: 200px; height: 100px; line-height: 100px; background: #f00; -webkit-transition-duration: 2s; } .animation:hover { -webkit-animation-name: anim; -webkit-animation-duration: 2s; -webkit-animation-timing-function: linear; -webkit-animation-direction: alternate; -webkit-animation-iteration-count: infinite; } @-webkit-keyframes anim { 0% { width: 80px; height: 30px; line-height: 30px; background: #06F; } 50% { width: 140px; height: 65px; line-height: 65px; background: #360; } 100% { width: 200px; height: 100px; line-height: 100px; background: #f00; } }


参考资料

版权声明:本文为博主原创文章,未经博主允许不得转载。

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • WEB2.0标准教程:第六天XHTML代码规范_div+css布局教程

    WEB2.0标准教程:第六天XHTML代码规范_div+css布局教程

    2015-10-02 13:15

  • DIV CSS的XHTML代码结构浅谈-不要真DIV CSS了_div+css布局教程

    DIV CSS的XHTML代码结构浅谈-不要真DIV CSS了_div+css布局教程

    2015-09-27 17:13

  • Div CSS布局应该注重语义、注重代码的重用性!_div+css布局教程

    Div CSS布局应该注重语义、注重代码的重用性!_div+css布局教程

    2015-09-27 16:06

  • 关于条件注释的几个实例代码_div+css布局教程

    关于条件注释的几个实例代码_div+css布局教程

    2015-09-27 14:12

网友点评
>