猿问

CSS3中的过渡能否过渡回初始值?

比如本例中黄色块向右扩大后能否再缩回原始大小?

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:yellow;
transition-property:width 1s linear 2s;
/* Firefox 4 */
-moz-transition:width 1s linear 2s;
/* Safari and Chrome */
-webkit-transition:width 1s linear 2s;
/* Opera */
-o-transition:width 1s linear 2s;
}

div:hover
{
width:200px;
}
</style>
</head>
<body>

<div></div>

<p>请把鼠标指针放到黄色的 div 元素上,来查看过渡效果。</p>

<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>

<p><b>注释:</b>这个过渡效果会在开始之前等待两秒。</p>

</body>
</html>


uandsun
浏览 1737回答 1
1回答

悠然的夜色

可以缩回
随时随地看视频慕课网APP
我要回答