我在这里有一个圆圈,当我将鼠标悬停在圆圈上时,圆圈会随着尺寸的增加而增大。当我这样做时,“ +”在中间的“摇动”中。
HTML
<div class='test-ani'>
<span>+</span>
</div>
CSS(SCSS)
.test-ani {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
align-items: center;
justify-content: center;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: cornflowerblue;
user-select: none;
cursor: pointer;
&:hover {
transition: .5s;
width: 120px;
height: 120px;
}
span {
color: #ffdb58;
font-size: 50px;
padding: 0;
margin: 0;
}
}
视觉GIF
答案 0 :(得分:2)
动画变换规则:
section {
position: relative;
width: 100%;
height: 100%;
}
.test-ani {
position: absolute;
top: 50%;
left: 50%;
display: flex;
align-items: center;
justify-content: center;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: cornflowerblue;
user-select: none;
cursor: pointer;
}
.test-ani:hover {
transition: transform .5s;
transform: scale(1.2);
}
.test-ani span {
color: #ffdb58;
font-size: 50px;
padding: 0;
margin: 0;
}
<section>
<div class='test-ani'>
<span>+</span>
</div>
</section>