国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

CSS3中transition功能怎么使用?

2020-03-24 18:17:09
字體:
來源:轉載
供稿:網友
1.transition功能

transition屬性的使用方法:transition:property duration timing-function;

其中property表示對哪個屬性進行平滑過渡,duration表示多長時間完成屬性值的平滑過渡,timing-function表示通過什么方法來進行平滑過渡。

多平滑過渡示例:

 1 !DOCTYPE html 2 html lang= zh-CN 3 head 4  meta http-equiv= content-type content= text/html; charset=utf-8 5  meta http-equiv= x-ua-compatible content= IE=edge 6  meta name= viewport content= width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no 7  title 測試 /title 8 /head 9 body 10 div id= test /div 11 style 12 #test{13  width: 500px;14 height: 500px;15 background-color: yellow;16 /*css動畫*/17  transform: rotate(0);18 -webkit-transition: transform 0.5s linear, width 0.5s linear;19 -moz-transition: transform 0.5s linear, width 0.5s linear;20 -ms-transition: transform 0.5s linear, width 0.5s linear;21 -o-transition: transform 0.5s linear, width 0.5s linear;22 transition: transform 0.5s linear, width 0.5s linear;23 }24 #test:hover{25 width: 200px;26 transform: rotate(180deg);27 }28 /style 29 /body 30 /html 
2.animation功能

使用示例:

 1 !DOCTYPE html 2 html lang= zh-CN 3 head 4  meta http-equiv= content-type content= text/html; charset=utf-8 5  meta http-equiv= x-ua-compatible content= IE=edge 6  meta name= viewport content= width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no 7  title 測試 /title 8 /head 9 body 10 div id= test /div 11 style 12 /*animation動畫*/13  @-webkit-keyframes colorChange {14 0%{15 background-color: deepskyblue;16 }  50%{18  background-color: red;19 }20  100%{21 background-color: deepskyblue;22 }23 }24  #test{25 width:500px;26 height: 500px;27  background-color: deepskyblue;28 }29 #test:hover{30 animation-name: colorChange;  animation-duration: 1s;32 animation-timing-function: linear;33 }34 /style 35 /body 36  /html 

實現動畫的方法:

方法屬性值的變化速度linear在動畫開始時與結束時以同樣的速度進行變化ease-in動畫開始時速度很慢,然后速度沿曲線值進行加快ease-out動畫開始時速度很快,然后速度沿曲線值進行放慢ease動畫開始時速度很慢,然后速度沿曲線值進行加快,然后再沿曲線值進行放慢ease-in-out動畫開始時速度很慢,然后速度沿曲線值進行加快,然后再沿曲線值進行放慢

以上就是CSS3中transition功能怎么使用?的詳細內容,html教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 雷波县| 霍城县| 西吉县| 贵定县| 自治县| 呼图壁县| 镇雄县| 耒阳市| 遵化市| 雷山县| 乐平市| 红安县| 通海县| 抚顺市| 达日县| 厦门市| 上高县| 准格尔旗| 宜阳县| 南宫市| 禄丰县| 大兴区| 福海县| 密山市| 泰州市| 平果县| 兴安盟| 襄樊市| 开封市| 峡江县| 定结县| 增城市| 长葛市| 招远市| 上杭县| 石棉县| 靖宇县| 茶陵县| 策勒县| 普兰店市| 化德县|