css3的transition 过渡效果

浏览器支持

属性 浏览器支持
transition          

Internet Explorer 10、Firefox、Chrome 以及 Opera 支持 transition 属性。

Safari 需要前缀 -webkit-。

注释:Internet Explorer 9 以及更早的版本,不支持 transition 属性。

注释:Chrome 25 以及更早的版本,需要前缀 -webkit-。


过渡属性

下面的表格列出了所有的转换属性:

属性 描述 CSS
transition 简写属性,用于在一个属性中设置四个过渡属性。 3
transition-property 规定应用过渡的 CSS 属性的名称。 3
transition-duration 定义过渡效果花费的时间。默认是 0。 3
transition-timing-function 规定过渡效果的时间曲线。默认是 "ease"。 3
transition-delay 规定过渡效果何时开始。默认是 0。 3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
	div{
		width:100px;
		height:100px;
		background:#0FF;
		position:absolute;
		font-weight:bold;
		padding:20px 10px 0px 10px;
		float:left;
		margin:5px;
		text-align:center;
		transition: width 2s, height 2s;
		-moz-transition:width 2s , height 2s , -moz-transform 2s;
		-webkit-transition:width 2s, height 2s, -webkit-transform 2s; 
		-o-transition:width 2s, height 2s, -o-transform 2s;
		-webkit-transition:-webkit-transform 1s,opacity 1s,background 1s,width 1s,height 1s,font-size 1s;
		border-radius:5px;
		-webkit-border-radius:5px;
		-o-transition-property:width,height,-o-transform,background,font-size,opacity;
		-o-transition-duration:1s,1s,1s,1s,1s,1s;
		-moz-transition-property:width,height,-o-transform,background,font-size,opacity;
		-moz-transition-duration:1s,1s,1s,1s,1s,1s;
		transition-property:width,height,transform,background,font-size,opacity;
		transition-duration:1s,1s,1s,1s,1s,1s;
		opacity:0.4;
	}	
	div:hover{
		width:200px;
		height:200px;
		background:#0F0;
		opacity:1;
		font-size:16px;
		text-align:center;
		transform:rotate(360deg);
		-moz-transform:rotate(360deg); /* Firefox 4 */
		-webkit-transform:rotate(360deg); /* Safari and Chrome */
		-o-transform:rotate(360deg); /* Opera */
	}

</style>
<title>无标题文档</title>
</head>

<body>
<div>transtion的过渡效果</div>
</body>
</html>
效果图:

过渡前的:

过渡后的:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值