gpt4 book ai didi

CSS :hover transform scale command rotate object instead

转载 作者:行者123 更新时间:2023-12-01 22:28:24 24 4
gpt4 key购买 nike

.arrow {
display: inline-block;
height: 8px;
width: 8px;
margin-top: 20px;
border-top: solid black 2.5px;
border-left: solid black 2.5px;
-ms-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transition: transform 1s;
-moz-transition: transform 1s;
transition: transform 1s;
cursor: pointer;
}
.arrow::before {
content: "";
display: inline-block;
width: 18px;
margin-left: -3px;
margin-bottom: 7px;
border-top: solid black 1.8px;
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow:hover {
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
-moz-transform: scale(1.2);
transform: scale(1.2);
}
<span class="arrow"></span>

我使用 css 绘制了一个箭头,并尝试使用 css :hover 和 transform:scale 创建悬停放大效果。然而,代码先旋转箭头,然后再按比例放大。我想知道为什么会发生轮换,我该如何解决?提前致谢!

最佳答案

.arrow {
display: inline-block;
height: 8px;
width: 8px;
margin-top: 20px;
border-top: solid black 2.5px;
border-left: solid black 2.5px;
-ms-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transition: transform 1s;
-moz-transition: transform 1s;
transition: transform 1s;
cursor: pointer;
}
.arrow::before {
content: "";
display: inline-block;
width: 18px;
margin-left: -3px;
margin-bottom: 7px;
border-top: solid black 1.8px;
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow:hover {
-ms-transform: rotate(-45deg) scale(1.2);
-webkit-transform: rotate(-45deg) scale(1.2);
-moz-transform: rotate(-45deg) scale(1.2);
transform: rotate(-45deg) scale(1.2);
}
<span class="arrow"></span>

问题是转换属性不总结,如果您覆盖一个属性并想保持它的原始值,您需要重复它。

关于CSS :hover transform scale command rotate object instead,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30798601/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com