transition animation

1.transition?


div {

width: 50px;

height: 50px;

-webkit-transition: width 2s, height 2s, -webkit-transform 2s; /* For Safari 3.1 to 6.0 */

transition: width 2s, height 2s, transform 2s;

}

div:hover {

width: 100px;

height: 100px;

-webkit-transform: rotate(90deg); /* Chrome, Safari, Opera */

transform: rotate(90deg);

}

2.animation

div

{

animation:myfirst5s linear2s infinite alternate;

/* Safari與Chrome: */

-webkit-animation:myfirst5s linear2s infinite alternate;

}

@keyframes myfirst

{

0%{background:red;left:0px;top:0px;}

25%{background:yellow;left:200px;top:0px;}

50%{background:blue;left:200px;top:200px;}

75%{background:green;left:0px;top:200px;}

100%{background:red;left:0px;top:0px;}

}

@-webkit-keyframes myfirst/* Safari與Chrome */

{

0%{background:red;left:0px;top:0px;}

25%{background:yellow;left:200px;top:0px;}

50%{background:blue;left:200px;top:200px;}

75%{background:green;left:0px;top:200px;}

100%{background:red;left:0px;top:0px;}

}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 各種純css圖標(biāo) CSS3可以實(shí)現(xiàn)很多漂亮的圖形,我收集了32種圖形,在下面列出。直接用CSS3畫出這些圖形,要比...
    劍殘閱讀 9,988評(píng)論 0 8
  • transform、transition、animation分別代表著轉(zhuǎn)換、過(guò)渡以及動(dòng)畫。從各自的名字我們就可以大...
    Ginkela閱讀 4,028評(píng)論 0 12
  • 1、垂直對(duì)齊 如果你用CSS,則你會(huì)有困惑:我該怎么垂直對(duì)齊容器中的元素?現(xiàn)在,利用CSS3的Transform,...
    kiddings閱讀 3,299評(píng)論 0 11
  • 5.橢圓 #ellipse{ width: 200px; height: 100px; background-co...
    小茶葉葉閱讀 2,216評(píng)論 0 1
  • 充分表達(dá)憤怒 生活中常常會(huì)遇到讓你生氣憤怒的人或事,你是怎么做的呢?破口大罵、大打出手還是默默承受。讀完這一章相信...
    冰雪卡其閱讀 408評(píng)論 1 1

友情鏈接更多精彩內(nèi)容