所以我有一个在
容器内的。这个对象设置了max-width (600px)和max-height (400px)属性。当我将鼠标悬停在对象上时,属性被设置为none,以便可以正确地呈现对象的宽度和高度。然而,当鼠标移出时,它立即改变其宽度和高度为max-width (600px)和max-height (400px)值,并在一秒钟后回到其原始宽度和高度值。
那么我该如何过渡来使对象在悬停和鼠标移出时平滑地改变其宽度和高度?
HTML:
那么我该如何过渡来使对象在悬停和鼠标移出时平滑地改变其宽度和高度?
HTML:
<html>
<!-- Blah blah some head tags here. -->
<body>
<div id="c_a">
<object data="https://www.google.ro/images/srpr/logo11w.png" type="image/png"></object>
</div>
</body>
</html>
CSS:
html{
font-size: larger;
width: 100%;
height: 100%;
}
#c_a object{
transition: width 1s linear .5s, height 1s linear .5s;
-webkit-transition: width 1s linear .5s, height 1s linear .5s;
-o-transition: width 1s linear .5s, height 1s linear .5s;
-moz-transition: width 1s linear .5s, height 1s linear .5s;
position: relative;
width: 100%;
height: 100%;
max-width: 600px;
max-height: 400px;
vertical-align: text-top;
}
#c_a object:hover{
width: 200%;
height: 200%;
max-width: none;
max-height: none;
}
div
上指定任何宽度/高度。你必须这样做。 - Abhitalksmax-width
被突破时,它就会弹回。是的。请给我一些时间。 - Abhitalks