【发布时间】:2016-09-20 08:32:49
【问题描述】:
此代码在 Chrome 上按预期运行:
请将鼠标悬停在蓝色球上观看动画:
<!DOCTYPE html>
<html>
<head>
<style>
.container {
position: relative;
width: 100%;
height: 200px;
border: thin solid #6D6;
overflow: hidden;
}
h2 {
position: absolute;
border-radius: 100%;
background-color: blue;
height:100px;
width: 100px;
transition:all 1s ease-out;
margin: auto;
left: 0;
top: 0;
bottom: 0;
right: 0;
}
h2:hover {
height: 300px;
width: 300px;
}
</style>
</head>
<body>
<div class='container'>
<h2></h2>
</div>
</body>
</html>
但在 Firefox 中,中间的球会扩展至底部,我必须设置顶部或底部才能将其恢复到正确位置。有没有办法让它保持在中间而不像在 Chrome 中那样分配顶部和底部值?
【问题讨论】:
标签: html css firefox css-transitions