[英]CSS3 only transition while hovered
I have an element with transition: margin-left 0.7s;
我有一个
transition: margin-left 0.7s;
元素transition: margin-left 0.7s;
on it. 在上面。
The transition works fine, but it also animates on zoom. 过渡效果很好,但也可以设置缩放动画。 Is there any way to stop this?
有什么办法可以阻止这种情况?
Examples using width
instead of margin-left
: 使用
width
而不是margin-left
示例:
JSFiddle: https://jsfiddle.net/7py46d3L/ JSFiddle: https ://jsfiddle.net/7py46d3L/
HTML: HTML:
<div></div>
CSS: CSS:
div {
transition: width 0.7s;
width: 5vw;
height: 10px;
}
div:hover {
width: 10vw
}
Understanding sizing in CSS 了解CSS的大小
There are two types of measurement units: 有两种类型的度量单位:
so in your example if you give width:5[any absolute lengths or in]then > it will work
因此,在您的示例中,如果您提供width:5 [任何绝对长度或in],那么它将起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.