【发布时间】:2020-09-30 18:12:08
【问题描述】:
我在旋转小圆盘时遇到问题 包含围绕一个大圆圈的图像的圆圈我也会旋转图像,这是不需要的行为。请参考下面的sn-p。
.big-circle {
position:relative;
border: 2px solid #d87272;
border-radius: 50%;
width: 500px;
height: 500px;
}
.small-circle {
position: absolute;
left: calc(50% - 41px);
top: calc(50% - 41px);
height: 82px;
width: 82px;
border: 2px solid #d87272;
border-radius: 50%;
}
.small-circle:nth-child(1) {
transform: translateX(250px);
}
.small-circle:nth-child(2) {
transform: rotate(90deg) translateX(250px);
}
.small-circle:nth-child(3) {
transform: rotate(180deg) translateX(250px);
}
.small-circle:nth-child(4) {
transform: rotate(270deg) translateX(250px);
}
.small-circle img{
width: 100%;
border-radius: 50%;
}
<div class="big-circle">
<a href="#" class="small-circle">
<img src="https://via.placeholder.com/82" alt=""></a>
<a href="#" class="small-circle">
<img src="https://via.placeholder.com/82" alt=""></a>
<a href="#" class="small-circle">
<img src="https://via.placeholder.com/82" alt=""></a>
<a href="#" class="small-circle">
<img src="https://via.placeholder.com/82" alt=""> </a>
</div>
【问题讨论】:
-
我会说,为什么还要轮换它们呢?只需使用 translateX AND translate Y 将它们轻推到位。