【发布时间】:2020-05-31 01:50:44
【问题描述】:
所以我在div 容器中有一个object。该对象具有max-width (600px) 和max-height (400px) 属性集。当我将对象悬停时,属性设置为none,因此可以正确呈现对象的width 和height。但是,当将鼠标移出object 时,它会立即将其width 和height 更改为max-width (600px) 和max-height (400px) 值,并且在一秒钟后它会恢复到原来的width 和height 值.
那么,当鼠标悬停在它上面和鼠标移出时,我怎样才能使object 平滑地变为width 和height。
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;
}
【问题讨论】:
标签: html css css-transitions