css3新增过渡属性transition使用
1.两个属性过渡(使用逗号分割)
transition:width 1s,height 1s;
2.让一个元素从有到无的消失(使用opacity)
transition:opacity 1s;
3.不兼容ie9与及ie9以下的低版本浏览器
在这里插入代码片
<html>
<style>
div{
width:200px;
height:200px;
background-color:skyblue;
}
.p1{
width:100px;
height:100px;
background-color:pink;
transition:width 1s,height 1s; //
}
div:hover .p1{
width:180px;
height:180px;
}
.p2{
width:100px;
height:100px;
background-color:pink;
transition:opacity 1s; //
}
div:hover .p2{
opacity:0;
}
</style>
<body>
<div>
<p class="p1">hello</p>
</div>
<div>
<p class="p2">world</p>
</div>
</body>
</html>