CSS 如何用css慢慢转换比例?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25119736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:26:57 来源:igfitidea点击:
how to slowly transform scale with css?
提问by MrLars
I currently have it like this:
我目前有这样的:
But for some reason if I change the css to this:
但是出于某种原因,如果我将 css 更改为:
div {
width: 200px;
height: 100px;
background-color: yellow;
}
div:hover {
-moz-transform: scale(1.05) slow;
-webkit-transform: scale(1.05) slow;
-o-transform: scale(1.05) slow;
-ms-transform: scale(1.05) slow;
-webkit-transform: scale(1.05) slow;
transform: scale(1.05) slow;
}
It wont work.
它不会工作。
So I am guessing it cant be done this way?
所以我猜它不能这样做?
回答by speak
You need to add a transition
你需要添加一个 transition
-webkit-transition: transform 2s ease-in-out;
For more information please consult: Using CSS Transitions
更多信息请参考:使用 CSS Transitions
回答by Rasel
transition in other browser
在其他浏览器中过渡
div:hover {
-moz-transform: scale(1.05);
-webkit-transform: scale(1.05);
-o-transform: scale(1.05);
-ms-transform: scale(1.05);
-webkit-transform: scale(1.05);
transform: scale(1.05);
-webkit-transition: transform 1.05s ease-in-out;
-moz-transition:transform 1.05s ease-in-out;
-ms-transition:transform 1.05s ease-in-out;
}